2001 Microchip Technology Inc.
DS39024B-page 59
USART.C
Description
6.6
USART.C
Source Code Listing
//****************************************************
//* USART.C
//****************************************************
//* Rodger Richey
//* Principal Applications Engineer
//* Microchip Technology Incorporated
//****************************************************
//* 2 December 1998
//* Compiled using MPLAB C17 C Compiler V2.20
//****************************************************
//* This program prints an incrementing count from
//* 0 to 255 to the USART. The numbers are displayed
//* in the Monitor program.
//****************************************************
//* Uses an oscillator of 16MHz
//****************************************************
#include <p17c756.h>
#include <delays.h>
#include <usart16.h>
#include <stdlib.h>
void PutsUSART2(char *data);
// Function to print a string to USART2 using handshaking
void PutsUSART2(char *data)
{
do
{
// Wait for USART to complete prev operation
while(BusyUSART2());
// Hardware handshaking for CTS
while(PORTBbits.RB4);
// Print a character to USART2
putcUSART2(*data);
} while(*data++); // Increment pointer and check for NULL
return;
}
void main(void)
{
unsigned char i;
char str[5];
char crlf[3];
// Initialize the carriage return/linefeed string
crlf[0] = 0x0d;
crlf[1] = 0x0a;
crlf[2] = 0;
// Initialize USART2 and the hardware handshaking lines
PORTBbits.RB5 = 1;
DDRBbits.RB5 = 0;
Содержание Picdem 17
Страница 1: ...PICDEM 17 DEMONSTRATION BOARD USER S GUIDE 2001 Microchip Technology Inc DS39024B ...
Страница 19: ... 2001 Microchip Technology Inc DS39024B page 13 Using the PICDEM 17 Monitor Figure 2 5 Running Diagnostics ...
Страница 24: ...PICDEM 17 Demonstration Board User s Guide DS39024B page 18 2001 Microchip Technology Inc NOTES ...
Страница 28: ...PICDEM 17 Demonstration Board User s Guide DS39024B page 22 2001 Microchip Technology Inc NOTES ...
Страница 40: ...PICDEM 17 Demonstration Board User s Guide DS39024B page 34 2001 Microchip Technology Inc NOTES ...
Страница 62: ...PICDEM 17 Demonstration Board User s Guide DS39024B page 56 2001 Microchip Technology Inc NOTES ...
Страница 80: ...PICDEM 17 Demonstration Board User s Guide DS39024B page 74 2001 Microchip Technology Inc NOTES ...
Страница 82: ...PICDEM 17 Demonstration Board User s Guide DS39024B page 76 2001 Microchip Technology Inc A 1 SCHEMATIC 1 ...
Страница 83: ... 2001 Microchip Technology Inc DS39024B page 77 PICDEM 17 Demonstration Board Schematics A 2 SCHEMATIC 2 ...
Страница 84: ...PICDEM 17 Demonstration Board User s Guide DS39024B page 78 2001 Microchip Technology Inc A 3 SCHEMATIC 3 ...
Страница 85: ... 2001 Microchip Technology Inc DS39024B page 79 PICDEM 17 Demonstration Board Schematics A 4 SCHEMATIC 4 ...
Страница 86: ...PICDEM 17 Demonstration Board User s Guide DS39024B page 80 2001 Microchip Technology Inc NOTES ...
Страница 90: ...PICDEM 17 Demonstration Board User s Guide DS39024B page 84 2001 Microchip Technology Inc NOTES ...
Страница 91: ... 2001 Microchip Technology Inc DS39024B page 85 Floppy Disk Contents NOTES ...