Byte formatting function b(Source {, Format})
Specifies byte sized (8-bit, values 0 to 255) data as an argument to a supporting hash function. The first argument specifies where to get the data (the source). The second, optional, argument specifies the actual display format. If the format is not specified, the format defaults to decimal, variable width.
While the obvious use of this is in the Print()
hash function, it can also be used in such functions as SetCursor
or HBar
.
Source specifiers
The following are the allowable source specifiers
Form | Meaning | Example |
---|---|---|
| Contents of the X register |
|
| Contents of the Y register |
|
| Contents of the H register (RTC hours) |
|
| Contents of the M register (RTC minutes) |
|
| Contents of the S register (RTC seconds) |
|
| Contents of the I register |
|
| Contents of an EQUated constant |
|
A number 0 - 255 | An immediate numeric value |
|
| Contents of a RAM byte (variable) |
|
index/jndex modifiers
RAM variable references can also have index/jndex modifiers
Form | What is sourced | Example code |
---|---|---|
| Whatever is in RAM (byte) variable |
|
| Whatever is in RAM (byte) variable |
|
NOTE: The modifier (+
or -
) must be after the asterisk. jndexing applies only to code running inside a MultiTrack task.
Format specifiers
The format argument specifies how the number is to be displayed. Valid format specifiers are:
Form | Resulting format | Example | Result (the single quotes are NOT printed) |
---|---|---|---|
Blank (default) | Decimal, variable width |
|
|
| Decimal in fixed field width (3 characters) |
|
|
| Decimal in variable field width (as many characters positions as are needed. |
|
|
| Decimal, in 2 character field, padded with |
|
|
| Hexadecimal in a field of two character positions |
|
|
c | ASCII character |
| 'A' |