Problem with USART in PIC16F877

Status
Not open for further replies.

saeed_pk

Full Member level 4
Joined
May 20, 2006
Messages
237
Helped
35
Reputation
68
Reaction score
28
Trophy points
1,308
Location
Islamabad, Pakistan
Activity points
2,655
Hi alls,
I am using usart in PIC16F877 i want to make a Parallel to serial converter baud rate 1200 bps i made PORT B as inputs and i want to transmit serially what is fed to PORTB

i am using Mikro C Compiler by MicroElectronica and using following code
unsigned short i;

void main()
{
TRISB=0x0F;
USART_init(1200);

while(1)
{

i=PORTB;
USART_Write(i);

}
}



it does not work

but when i just receive 0-255 numbers it works by following code


unsigned short i;

void main()
{
TRISB=0x0F;
USART_init(1200);
// initialize USART modul // (8 bit, 2400 baud rate, no parity bit...
for(i=0;i<256;i++)
{
USART_Write(i);
if(i==255)
i=0;
}
}



Please Help me what i do
 

Is this a commercial project ? I have complete design ready if required.
 
Hi!
I think that there is some problem with ur PORTB. My suggestion is that you make the whole of the PORTB as an input and then try ur code also check the signals on the PORT to make sure that correct data is being read by the controller from the port.

Regards.
 

Take an oscilloscope and debug your hardware - but make sure the PIC is OK.
 

hello VSMGUY,

Are u still at the edaboard?

If so can u pls send me the codes u have developed.
Am in need of sample codes, glad if it is in MikroC, which will transmit data captured by CCP module of pic16f877a to a Pc via USART (bluetooth)
thanks
 

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…