ragav4456
Full Member level 4
Hi friends
I doubt in PIC uart baudrate formula calculation in Program.
BRGH=1;BRG16=1; kindly send the sample code.
Sample code for PIC16f877A ic UART
- - - Updated - - -
how to change this code for pic16f1527 ic?
I doubt in PIC uart baudrate formula calculation in Program.
BRGH=1;BRG16=1; kindly send the sample code.
Sample code for PIC16f877A ic UART
Code:
int X;
/* calculate and set baud rate register */
/* for asynchronous mode */
tmp = 16UL * baud;
X = (int)(FOSC/tmp) - 1;
if((X>255) || (X<0))
{
tmp = 64UL * baud;
X = (int)(FOSC/tmp) - 1;
if((X>255) || (X<0))
{
return 1; /* panic - baud rate unobtainable */
}
else
BRGH=0; /* low baud rate */
}
- - - Updated - - -
how to change this code for pic16f1527 ic?