Maker Pro
Maker Pro

PIC16F873/7A UART Receiving problem

anroop

Dec 11, 2013
65
Joined
Dec 11, 2013
Messages
65
I have used PIC16F873A/7A series to receive a byte from PC and compare it with predefined string and produce result such as making an output high if they are same.
My problem is with receiving data. i am not able to find out if the data is received. i have tried by waiting for the pic to produce RCIF flag as HIGH (when uart receives 1 byte of data) and then storing the byte in RCREG to a Unsigned temporary variable. I am using Mikro C pro. please help me with this if you have info.

The config I did for UART Rx. enable are:
* port c as output and port c 6th & 7th pin were made high
* spen was enabled
*cren was enbled
*sync=0 (asynchronous communication)
* high baud rate 9600
* 8 bit reception
 

kpatz

Feb 24, 2014
334
Joined
Feb 24, 2014
Messages
334
* port c as output and port c 6th & 7th pin were made high
When you say "pins were made high", did you set TRISC 6 & 7 high, which makes the pins input? Both TRISC 6 and TRISC 7 need to be high for the UART to work.

Setting PORTC values on these pins won't have any effect on the UART.

If you're using the other PORTC pins as outputs, set TRISC = 0xC0;
 

anroop

Dec 11, 2013
65
Joined
Dec 11, 2013
Messages
65
thanks Kpatz. It was my mistake in reding the Datasheet. Successfully received and responeded to the input.
 
Top