hey all

I am trying to interface a PIC16F876A with the PC using the hardware USART, using a max232. I can send data from the pic to PC no problems at all, but i can't get communication from PC to the pic.

So i wrote the following which should echo back binary numbers:

*******


DEFINE OSC 20

' Set receive register to receiver enabled
DEFINE HSER_RCSTA 90h
' Set transmit register to transmitter enabled
DEFINE HSER_TXSTA 20h
' Set baud rate
DEFINE HSER_BAUD 9600

DEFINE HSER_ CLROERR 1

datain var byte


TRISC.6 = 1
TRISC.7 = 0


main:

HSERIN [datain]

Hserout [datain]
goto main

End

********************


Now what it does is just echo back '0's, and furthermore it echos 0's constantly, wether anything is sent from the PC or not.

What is going wrong here?

Thanks for your help