Previous Topic

Next Topic

Book Contents

Book Index

iiPrintText dest#,text-string [D >= 23]

Print text.

The text string given in the instruction will be sent to the destination called for in dest.

The maximum number of bytes per message to the serial port is 255. However, the serial transmit buffer is 128 bytes (which could change in future Firmware revisions). If you try to send out more than the buffer can hold, your program will stall until there is room in the buffer (this is your whole program, not just a single MultiTrack task). You can avoid this by using COMTx_Space to ensure there is room before attempting to output.

The text "string" can be a comma-delimited list of bytes in any of the following formats:

Example

Max value

Description

23

255

Decimal constant

'A3

255

Hex constant

%10101100

255

Binary constant

"Hello"

 

A quoted text string

Strings may be any printable characters, enclosed in quotes. A quotation mark is represented by two quotation marks in a row, viz ""

Any number of individual bytes, words and strings may be concatenated, with commas separating them. Spaces are not allowed except within quoted strings.

Examples:

iiPrintText	SerOut,"The quick brown fox",'0D,'0A

will print the quoted message followed by '0D (carriage return) and '0A (line feed).

iiPrintText	XWBuf,'FF,'09,'E3,'67,'FF

would print a series of hexadecimal bytes, perhaps destined for an Xwire peripheral that can make sense of them.

This instruction is automatically indexed.

When printing to RAM the index register I is added to the dest address and the result is stored in that location. I is then incremented by the number of characters stored. This allows several things to be "printed" to RAM.

"Printing" to RAM is typically used for communicating with an Xwire peripheral.

The dest argument determines where the result of the instruction is directed.

Destination address (dest)

Where the result is directed

0 - 249

The result is stored in successive RAM locations, starting at dest. It will occupy as many RAM locations as are needed to contain the result, one location per character. For example, the result of iifPrintWFW 25,7,3 will occupy 7 bytes, RAM locations 25 through 31, because the format specifier calls for 7 digits of output. A runtime error will occur if the output over-runs the end of RAM (address 249). Using RAM as the destination is particularly useful for sending data out on Xwire.

Note: These addresses are not jndexed. Instead they use I as an offset from the dest address, and automatically increment I by the number of bytes stored in RAM by the instruction.

251

The result is directed to the serial port, providing the selected protocol is "User programmable". This is the primary means of generating any arbitrary serial output under program control.


Dialect restriction: This instruction is not implemented in boards with dialect numbers less than 23.

See also iiPrintNVText

Previous Topic

Next Topic