Hi,
This is a sample code with 16F877:
It receives a byte from UART and then sends it back:
Code:
#include <16F877.h>
#fuses HS, NOWDT
#use delay(clock=10000000) //10MHz
#use rs232(baud=9600,parity=N,xmit=PIN_C6,rcv=PIN_C7,stream=RS232,bits=8)
void main(void){
char k;
while (1){
k = getchar(); //recive the character
putchar(k); //echo it back
}
You could build on from this. Using the #use RS232 directive, you can use the getchar(), putchar() and printf() functions.
Hope this helps.
Tahmid.
---------- Post added at 15:10 ---------- Previous post was at 15:10 ----------
I'm not very good with CCS, that's as far as my knowledge with CCS goes.