04.03.2013 Views

Basic Micro Studio Syntax Manual

Basic Micro Studio Syntax Manual

Basic Micro Studio Syntax Manual

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Commands<br />

SETHSERIAL<br />

M<strong>Basic</strong> must create a buffer in memory for each UART and specify the baud rate for that UART. The<br />

directive SETHSERIAL sets the available parameters for the specifi ed UART. This is only required<br />

once at the beginning of a program. There are two UARTs available on some processors. To set<br />

UART1 use SETHSERIAL1 and to set UART2 use SETHSERIAL2.<br />

The SETHSERIAL1 command is used to set UART1 as shown below:<br />

sethserial1, baudrate {,databits, parity, stopbits} ;Set UART1<br />

The SETHSERIAL2 command is used to set UART2 as shown below:<br />

sethserial2, baudrate {,databits, parity, stopbits} ;Set UART2<br />

Baud Rate<br />

SETHSERIAL is also used to set the baud rate for HSERIAL. The other arguments shown below<br />

are optional. They are typically set when attached to a proprietary device. Rarely would these be set<br />

when communicating to a PC.<br />

• Baudrate - is a predefi ned value that specifi es the transmit and receive rate. Different processors<br />

support different baud rates. See Supported Baud Rate Table.<br />

• DataBits - is an optional argument that defi nes how many bits are used. The default is 8. See the<br />

Supported Options Table below.<br />

• Parity - is an optional argument that sets what the parity bit is. No parity, even parity or odd parity<br />

are supported. The default is no parity (N). See the Supported Options Table below.<br />

• Stopbits - is an optional argument that specifi es 1 or 2 stop bits in the serial format. The default<br />

is 1. See the Options Supported Table below.<br />

Supported Options<br />

DataBits Parity StopBits<br />

H8DATABITS HNOPARITY H1STOPBIT<br />

H7DATABITS HEVENPARITY<br />

HODDPARITY<br />

H2STOPBIT<br />

119

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!