pic16f877a uart c code problm

Hai to all,

Iam trying to communicate from pic 16f877a to the pc's hyperterminal at

9600 baud rate. Iam posting my code for this.

Iam able to simulate with mplab but I could not implement with hardware. I checked for max232, rs232. They seem to be working perfect. But iam not getting the data through hyperterminal comm port.

My crystal oscillator is 8mhz.

/* uart serial communication at 9600 baud rate*/ /*spbrg=(8Mhz/(9600)/16)-1*/

#include //unsigned char data[6]="fabmax"; unsigned char i; /*void interrupt isr(void) { if(TXIF==1) {

for(i=0;i

Reply to
sivaramakrishna
Loading thread data ...

Can you communicate with other serial devices with hyperterminal?

Are you getting anything out of the max232 on your board?

Is your serial cable wired the way you think it is?

Reply to
Bill Chernoff

There is no test here to make sure the data has left before you shove the next value in. Look at the data sheet for the transmit complete flag. The start of the code looks like you were playing with the UART interrupts at one point or another, but that's not going to help you with the above code.

Reply to
James Beck

I

You need an interupt driven, buffered, handshaking system to get performance. Email me for some code, it's not for a pic but it's easily modified, more for instruction as to what to do and how to do it.

Reply to
cbarn24050

/snap/

Seems you commented out interrupt routines (ISRs); why did you do that? To make a joke?

--
StoneThrower
www.dgmicrosys.com
Reply to
Stonethrower

Try using TeraTerm instead of HyperTerminal: its much more forgiving (see numerous past posts on the subject). In particular HyperTerminal has a tendency to require the modem control signals even when you tell it to ignore them.

Have you checked that you are seeing the correct voltages on the PIC's TX line and the MAX232 TX? You can do this by wobbling the port not just sending a character. That way you can be sure that the hardware path is correct before worrying about serial communication. Have you checked that the lead you are using to the PC is correct?

Reply to
Andrew Jackson

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.