程式碼:
' {$STAMP BS2}
' {$PBASIC 2.5}
code VAR Byte
decode VAR Byte
zero CON %00000000
one CON %01111011
two CON %00101100
three CON %00101001
four CON %01001011
five CON %10001001
six CON %10001000
seven CON %00111011
eight CON %00001000
nine CON %00001001
OUTH = %00000000
DIRH = %11111111
DO
SERIN 16, 16468,[STR code\1]
decode = code
IF code = 48 THEN
OUTH = zero
ELSEIF code = 49 THEN
OUTH = one
ELSEIF code = 50 THEN
OUTH = two
ELSEIF code = 51 THEN
OUTH = three
ELSEIF code = 52 THEN
OUTH = four
ELSEIF code = 53 THEN
OUTH = five
ELSEIF code = 54 THEN
OUTH = six
ELSEIF code = 55 THEN
OUTH = seven
ELSEIF code = 56 THEN
OUTH = eight
ELSEIF code = 57 THEN
OUTH = nine
ENDIF
LOOP