Richa Verma
Newbie level 5
could anybody explain me the factors that decide the baud rate on which a communication device works?
Thanks in advance!
Thanks in advance!
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Hi,
The lower limit is: how many bits you want to transmit per time.
Then you have to multiply it by 1.25 (because of startbit and stopbit).
Then you need some headroom.
Also protocol may need some extra time..may be you need to transmit lost packages again.
Handshaking, full duplex, half duplex...
The upper limit depends on hardware (RS232, RS485), interface signaling, cable type, cable length...
Communication bridges in the signal lines (modem, bluetooth...)
Klaus
you need to configureHi horace1
I want to know about your 2nd option. "what determines for baud rate when configuring a UART in a microcontroller".
_CONFIG1( JTAGEN_OFF & GCP_OFF & GWRP_OFF & FWDTEN_OFF & ICS_PGx2)
_CONFIG2( PLL_96MHZ_ON & IESO_OFF & FCKSM_CSDCMD & OSCIOFNC_ON & POSCMOD_HS & FNOSC_PRIPLL & PLLDIV_DIV2 & IOL1WAY_ON)
// initialize UART
// Input: baud rate
// Output: 1 for OK, 0 if baud rate error > 3%
int UART2Init(const unsigned long int BAUDRATE)
{
unsigned long int BAUDRATEREG = (((SYSCLK/2)+(8ul*BAUDRATE))/BRG_DIV2/BAUDRATE-1);
unsigned long int BAUD_ACTUAL = ((SYSCLK/2)/BRG_DIV2/(BAUDRATEREG+1));
unsigned long int BAUD_ERROR = ((BAUD_ACTUAL > BAUDRATE) ? BAUD_ACTUAL-BAUDRATE : BAUDRATE-BAUD_ACTUAL);
unsigned long int BAUD_ERROR_PRECENT = ((BAUD_ERROR*100+BAUDRATE/2)/BAUDRATE);
// reconfigure the I/O pins if required
iPPSInput (IN_FN_PPS_U2RX, IN_PIN_PPS_RPI119); // dsPIC board pin 5
iPPSOutput(OUT_PIN_PPS_RP120, OUT_FN_PPS_U2TX); // pin 6
U2BRG = BAUDRATEREG; // set up baudrate
U2MODE = 0; // clear mode register
U2MODEbits.BRGH = BRGH2; //divider is 16
U2STA = 0; // clear status
_U2RXIF = 0; // clear interrupt flag
U2MODEbits.UARTEN = 1; // enable UART
U2STAbits.UTXEN = 1; // enable reansmit
if (BAUD_ERROR_PRECENT > 2)
{ printf("UART2baud rate %lu error %lu%%\n", BAUDRATE, BAUD_ERROR_PRECENT); return -1; }
printf("UART2 baud rate %lu set up\n", BAUDRATE);
return 0;
}
I am not getting why lower limit is multiplied with 1.25! How does multiplication factor 1.25 depends upon startbit and stopbit?