BAUD(x)
 
Syntax


BAUD( channel ) = rate      ' built-in keyword

Description -- added in version 7.13

BAUD (0) will set the baudrate for the RXD0, TXD0 pins, that will be used by PRINT, DEBUGIN, RXD(0) or TXD(0) functions.

BAUD(channel) will configure the pin to the UART function and set the baudrate for the corresponding UART. On reset these pins are configured as general purpose IOs.  Details on pin assignments in the Hardware Info pages for the different boards.

Baudrates for the LPC21xx and LPC23xx based boards are   15000/(n*16) in Kbaud    For instance, if you call BAUD(0)=115200, the closest n is 8, and the resultant baudrate is 117.2 Kb, which is less than 2% fast, which would normally be close enough. That can be improved by using the fractional divider.

Baudrates for the LPC17xx based boards are   25000/(n*16) in Kbaud.    n is an integer.  

All boards except the ARMexpress support fractional baud rate generation.  This is not part of the built in firmware, but can be engaged by writing directly to those registers.  Details in theCoridium Forum or the NXP User Manuals .

Example

BAUD(1) =19200        ' set the baud rate and enable serial I/O for UART1

BAUD(0) = 9600          ' set the baud rate for RXD0 and TXD0
 

Differences from other BASICs

See also