BAUD procedure

Language reference ›› Built-in procedures ›› "console" procedures ››
Parent Previous Next

baud-procedure = BAUD "(" rate [ "," restriction ] [ "," channel ] ")" .        
restriction = TX | RX .

Generate all initializations necessary to use asynchronous only communications at the given baud rate using the TXSTA / RCSTA registers.


If the processor has no such registers, an error will occur.

The generated code is optimized regarding to the current FREQUENCY and does not validate interrupts; this is left to the programmer.

After this procedure call, all asynchronous communications are ready to use (TRIS register bits, asynchronous mode, TX / RX mode).

If the given baud rate cannot be implemented within 1% accuracy, a compiler error will occur. The real baud rate and percent of error is output as comment in the .asm file.

NEW! (V2.0) <restriction> is an optional parameter that restricts the setup to TX or RX only:

NEW! (V2.0) <channel> is the optional EUSART channel number (1 to the nb of EUSART channels of the processor); defaults is 1.



 BAUD(19200, TX);
 BAUD(19200, RX, 2);
 BAUD(19200, 1);