I've read the data sheet for my PIC18F4550. It explains me everything (i.e. how turn on USART, how to set mode "synchronous, a synchronous"...). However, one part that I think is not clearly explained is how to read/write the Tx/Rx pins. Could you please help me with this write/read from the pins Rx/Tx (I prefer MPLAB C compiler)? For example, If I want to write '1' to the Tx, how do I use the method? Or how do I read from pin Rx?
In my Uc, there is a Data Buffer which you use in order to send data through TX (by writing that buffer) and to accept data through RX - data is accepted to RX every time you transmitting a byte.
You know, i'm writing
UDBUF = 0x03, and it transmit 0x03.
I wait for the transmit flag to get High to know that it has finished so i can trasmit my next byte.
When the RX register gets full (ie. receives the transmited byte), the RCIF flag will be set. You can set up an interrupt to let you know when RCREG is full.
Then you can set up something like
x=RCREG;
Are you using interrupts or are you polling the RCIF to see if data is has been received ?
When the RX register gets full (ie. receives the transmited byte), the RCIF flag will be set. You can set up an interrupt to let you know when RCREG is full.
Then you can set up something like
x=RCREG;
Are you using interrupts or are you polling the RCIF to see if data is has been received ?