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.

Modifi ers<br />

In M<strong>Basic</strong>, all values are received and stored as binary. Modifi ers were created for formatting the<br />

data used in commands that have input or output (SERIN / SEROUT). The modifi ers are useful for<br />

formatting data being printed to a terminal window. All characters are represented in ASCII. Modifi ers<br />

format the ASCII values to display properly based on the modifi er used.<br />

An example of a command modifi er is formatting a decimal value. The decimal value 32 would output<br />

to a terminal window as a space character. Instead, to display the actual decimal value of the variable<br />

you would use the DEC modifi er:<br />

Temp Var Byte<br />

Temp = 32<br />

serout s_out, i9600, [DEC TEMP]<br />

The code snippet above would display the value of temp which is set to 32. If the DEC modifi er was<br />

not used, a space character (“ “) would be displayed instead.<br />

Several modifi ers are input only modifi ers such as WAIT which would cause an input command to<br />

wait until the received data matches a specifi ed string.<br />

Some modifi ers have variants. In SBIN the “S” stands for signed. Where in IBIN the “I” represents<br />

the indicator. The indicator is the symbol used to indicate the numeric type such as binary (%) or<br />

hexadecimal ($).<br />

Modifi ers can be used with the following commands:<br />

Output Modifi ers Input Modifi ers<br />

DEBUG DEBUGIN<br />

I2COUT I2CIN<br />

OWOUT OWIN<br />

SEROUT SERIN<br />

HSEROUT HSERIN<br />

LCDWRITE LCDREAD<br />

WRITEDM<br />

DTMFOUT<br />

DTMFOUT2<br />

READDM<br />

Output modifi ers can also be used to modify array variables:<br />

string var byte(100)<br />

string = “Hello World” ;string(0-10)=”Hello World”<br />

string = dec 1234567 ;string(0-6)=”1234567”<br />

string = ihex 0x3456 ;string(0-4)=”$3456”<br />

Structure - Modifi ers<br />

69

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

Saved successfully!

Ooh no, something went wrong!