You are here: PBASIC Language Reference > Conversion Formatters

Conversion Formatters

The tables below contain the conversion formatters available for the commands DEBUGIN, I2CIN, LCDIN, OWIN and SERIN and demonstrates, through various input/output data examples, exactly what will be received when using these formatters.

The following tables show data examples (characters received) across the top and formatters across the left side, with the results of that combination shown in the target cell.

For example, with the following code:

Value  VAR  WORD
DEBUGIN SDEC Value

...the Decimal Formatters table shows us that if the characters -123 (followed by a carriage return) are received, the SDEC formatter will translate that to the word-sized decimal number -123 and will store that value into the Value variable.

NOTE: In all tables below, values in target cells represent the number base of the formatter (decimal for DEC, hexadecimal for HEX, etc) except where noted.  Additionally, “--“ means no valid data (or not enough valid data) was received so the command will halt forever unless additional data is received or SERIN’s Timeout argument is used.

Decimal Formatters

Decimal Formatters Characters Received
123 123‡ -123‡ ‡123‡ 12345‡ 65536‡ 255255‡
DEC -- -- 123 123 123 12345 0 58647
DEC1 -- 1 1 1 1 1 6 2
DEC2 -- 12 12 12 12 12 65 25
DEC3 -- 123 123 123 123 123 655 255
DEC4 -- -- 123 123 123 1234 6553 2552
DEC5 -- -- 123 123 123 12345 0 25525
SDEC -- -- 123 -123 123 12345 0 -6889
SDEC1 -- 1 1 -1 1 1 6 2
SDEC2 -- 12 12 -12 12 12 65 25
SDEC3 -- 123 123 -123 123 123 655 255
SDEC4 -- -- 123 -123 123 1234 6553 2552
SDEC5 -- -- 123 -123 123 12345 0 25525

‡Means any non-decimal-numeric characters such as letters, spaces, minus signs, carriage returns, control characters, etc.  (Decimal numerics are: 0,1,2,3,4,5,6,7,8 and 9)

Hexadecimal Formatters

Hexadecimal Formatters Characters Received
1F 1F‡ -1F‡ ‡1F‡ 15AF‡ 10000‡ 3E517‡
HEX -- -- 1F 1F 1F 15AF 0 E517
HEX1 -- 1 1 1 1 1 1 3
HEX2 -- 1F 1F 1F 1F 15 10 3E
HEX3 -- -- 1F 1F 1F 15A 100 3E5
HEX4 -- -- 1F 1F 1F 15AF 1000 3E51
SHEX -- -- 1F -1F 1F 15AF 0 -1AE9
SHEX1 -- 1 1 -1 1 1 1 3
SHEX2 -- 1F 1F -1F 1F 15 10 3E
SHEX3 -- -- 1F -1F 1F 15A 100 3E5
SHEX4 -- -- 1F -1F 1F 15AF 1000 3E51

Note: The HEX formatters are not case sensitive. For example, 1F is the same as 1f.
‡Means any non-hexadecimal-numeric characters such as letters (greater than F), spaces, minus signs, carriage returns, control characters, etc.  (Hexadecimal numerics are: 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F).

Additional Hexadecimal Formatters

Additional Hexadecimal Formatters Characters Received
1F 1F‡ $1F $1F‡ -$1F‡ ‡$1F‡ $15AF‡
IHEX -- -- -- -- 1F 1F 1F 15AF
IHEX1 -- -- -- 1 1 1 1 1
IHEX2 -- -- -- 1F 1F 1F 1F 15
IHEX3 -- -- -- -- 1F 1F 1F 15A
IHEX4 -- -- -- -- 1F 1F 1F 15AF
ISHEX -- -- -- -- 1F -1F 1F 15AF
ISHEX1 -- -- -- 1 1 -1 1 1
ISHEX2 -- -- -- 1F 1F -1F 1F 15
ISHEX3 -- -- -- -- 1F -1F 1F 15A
ISHEX4 -- -- -- -- 1F -1F 1F 15AF

NOTE: The HEX formatters are not case sensitive.  For example, 1F is the same as 1f.
‡Means any non-hexadecimal-numeric characters such as letters (greater than F), spaces, minus signs, carriage returns, control characters, etc.  (Hexadecimal numerics are: 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F).

Binary Formatters

Binary Formatters Characters Received
11 11‡ -11‡ ‡11‡ 101‡ 3E517‡
BIN -- -- 11 11 11 101 1
BIN1 -- 1 1 1 1 1 1
BIN2 -- 11 11 11 11 10 1
BIN3 – BIN16 -- -- 11 11 11 101 1
SBIN -- -- 11 -11 11 101 1
SBIN1 -- 1 1 -1 1 1 1
SBIN2 -- 11 11 -11 11 10 1
SBIN3 – SBIN16 -- -- 11 -11 11 101 1

‡Means any non-binary-numeric characters such as letters, spaces, minus signs, carriage returns, control characters, etc.  (Binary numerics are: 0 and 1).

Additional Binary Formatters

Additional Binary Formatters Characters Received
11 11‡ %11 %11‡ -%11‡ ‡%11‡ %101‡
IBIN -- -- -- -- 11 11 11 101
IBIN1 -- -- -- 1 1 1 1 1
IBIN2 -- -- -- 11 11 11 11 10
IBIN3 – IBIN16 -- -- -- -- 11 11 11 101
ISBIN -- -- -- -- 11 -11 11 101
ISBIN1 -- -- -- 1 1 -1 1 1
ISBIN2 -- -- -- 11 11 -11 11 10
ISBIN3 – ISBIN16 -- -- -- -- 11 -11 11 101

‡Means any non-binary-numeric characters such as letters, spaces, minus signs, carriage returns, control characters, etc.  (Binary numerics are: 0 and 1).

NUM and SNUM with Decimal Data

General (Dec. Data) Characters Received
123 123‡ -123‡ ‡123‡ 12345‡ 65536‡ 255255‡
NUM -- -- 123 123 123 12345 0 58647
SNUM -- -- 123 -123 123 12345 0 -6889

‡Means any non-decimal-numeric characters such as letters, spaces, minus signs, carriage returns, control characters, etc.  (Decimal numerics are: 0,1,2,3,4,5,6,7,8 and 9).

NUM and SNUM with Hexadecimal Data

General (Hex. Data) Characters Received
1F 1F‡ $1F $1F‡ -$1F‡ ‡$1F‡ $15AF‡
NUM -- 1* 1* -- 1F 1F 1F 15AF
SNUM -- 1* 1* -- 1F -1F 1F 15AF

NOTE: Hexadecimal data is not case sensitive.  For example, 1F is the same as 1f.
‡Means any non-hexadecimal-numeric characters such as letters (greater than F), spaces, minus signs, carriage returns, control characters, etc.  (Hexadecimal numerics are: 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F).
*Invalid data; treated as decimal number one because no $ preceded it and non-decimal digit followed it.

NUM and SNUM with Binary Data

General (Bin. Data) Characters Received
11 11‡ %11 %11‡ -%11‡ ‡%11‡ %101‡
NUM -- -- 11* -- 11 11 11 101
SNUM -- -- 11* -- 11 -11 11 101

‡Means any non-binary-numeric characters such as letters, spaces, minus signs, carriage returns, control characters, etc.  (Binary numerics are: 0 and 1).
*Invalid data; treated as decimal number eleven because no % preceded it.

Go to Welcome page

BASIC Stamp Help Version 2.5.4

Copyright © Parallax Inc.

8/8/2012