#if defined(__PCM__)
#include <16F877.h>
#device adc=16
#use delay(clock=20000000)
#use rs232(baud=9600,xmit=PIN_C6,rcv=PIN_C7,brgh1ok)
#fuses XT, NOWDT, NOPROTECT, BROWNOUT, PUT, NOLVP
void main()
{
int value = 85;
char ch;
char string[64];
puts("**********************************");
puts(" RS232 demo with CCS C compiler ");
puts("**********************************");
/* start a new line (CR + LF) */
putc('\n');
putc('\r');
/* output variable in decimal format */
printf("Decimal variable output: %d\n\r", value);
/* output variable in hex format */
printf("Hex variable output: %x\n\r", value);
/* echo demo: PIC receives data and sends it back. */
/* If ENTER key is received, this demo exits. */
puts("Type on the keyboard, PIC will echo back the characters:");
while (1)
{
printf("Decimal variable output: %d\n\r", value);
/* read a single character */
ch = getc();
/* echo back the received character */
putc(ch);
}
}