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 />

Multiple UARTs<br />

When two UARTs are available they can be setup independently of each other. The UARTs can be<br />

set to different or the same baud rates. The second UART is only available on some processors. See<br />

the HSERIAL Capable Pin Table. To setup both UARTS follow the example below:<br />

sethserial1, H9600 ;Sets UART 1 to 9600 Baud<br />

sethserial2, H38400 ;Sets UART 2 to 38400 Baud<br />

Example<br />

The following example is a loop back. Wire the TX pin to the RX pin. It will receive and send to its self,<br />

demonstrating how the buffers work. Unlike normal SERIAL commands, the HSERIAL commands do<br />

not need to be running to receive data. Its handle in the background while the program is executing.<br />

sethserial1 h57600<br />

string var byte(20)<br />

integer var long<br />

main<br />

hserout [“Type a string upto 20 characters long and hit enter”,13]<br />

hserin [str string\20\13]<br />

hserout [“You string is: “,str string\20\13,13]<br />

hserout [“Type a decimal number and hit enter”,13]<br />

hserin [dec integer]<br />

hserout [“Your number is:”,dec integer,13]<br />

hserout [“Your number in Hexidecimal is:”,hex integer,13]<br />

hserout [“Your number in Bianry is:”,bin integer,13]<br />

goto main<br />

Supported Baud Rates<br />

BAP Error BAP40 Error BA Error BAN Error<br />

H300 0.16% H300 0.16% H2400 0.16% H600 0.16%<br />

H600 0.16% H600 0.16% H4800 0.16% H1200 0.16%<br />

H1200 0.16% H1200 0.16% H7200 0.22% H2400 0.16%<br />

H2400 0.16% H2400 0.16% H9600 0.16% H4800 0.16%<br />

H4800 0.16% H4800 0.16% H12000 0.16% H7200 0.64%<br />

H7200 0.64% H7200 0.22% H14400 0.22% H9600 0.16%<br />

H9600 0.16% H9600 0.16% H16800 0.55% H12000 0.79%<br />

H12000 0.79% H12000 0.16% H19200 0.16% H14400 0.79%<br />

H14400 0.79% H14400 0.94% H21600 0.22% H16800 0.79%<br />

H16800 0.79% H16800 0.55% H24000 0.16% H19200 0.16%<br />

H19200 0.16% H19200 1.36% H26400 0.74% H21600 0.64%<br />

H21600 0.64% H21600 0.22% H28800 0.94% H24000 0.79%<br />

H24000 0.79% H24000 0.16% H31200 0.16% H26400 0.32%<br />

H26400 0.32% H26400 1.36% H33600 0.55% H28800 2.12%<br />

H28800 2.12% H28800 1.36% H36000 0.79% H31200 0.16%<br />

H31200 0.16% H31200 0.16% H38400 1.36% H33600 0.79%<br />

H33600 0.79% H33600 2.10% H57600 1.36% H36000 0.79%<br />

H36000 0.79% H36000 2.12% H115200 1.36% H38400 0.16%<br />

120

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

Saved successfully!

Ooh no, something went wrong!