help.........I am getting problem with pic serial communication program.

Status
Not open for further replies.

ramanareddym

Newbie level 3
Joined
Dec 21, 2011
Messages
4
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,303
this is my code but it not giving any output on ter term serial window on my pc...


#include<pic.h>
void main(void)
{
TXSTA=0x24; //8-bit
RCSTA=0x90; //
BAUDCTL=0x12; //
SPBRG=71; //for 9600 baudrate..
TXEN=1;
SPEN=1;
while(1)
{
TXREG=0x41;
while(TXIF==0);
}
}
 

Try this code.
 

I generally agree, but next time please remember to at least write which PIC you are using, because different families have sometimes very different peripheral mechanisms (although what Easyrider83 said is true for all of PIC micros, maybe excluding pic32 because it's MIPS core and may have interrupts handled in different way).
 

ya tried......but same junk characters getting .........
 

wrong frequency!
What type of clock generator do you using? What frequency?
 

wonderful
show your configuration bits if you can't understand what i'm talking about
 

I am using Crystal oscillator 11.059MHz......
 

You forget to set BRG16=1 for this SPBRG value.
Or just use SPBRG=17 for default settings.
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…