pink help needed to read variable into BS2
Mososki
Posts: 3
I'm trying to read a variable (integer ex: 131) from the pink into the BS2.· I'm used the example shown in the PINK manual on page 8 and all I get is the code (49) for the first digit (1).· How can I get all three digits into a BS2 variable?· Here's a copy of what I'm using:
Mark
nbvar· VAR Byte(16)
SEROUT 8,396,[noparse][[/noparse]"!NB0R06"]
SERIN 9,396,[noparse][[/noparse]nbvar]
DEBUG DEC nbvar
Mark
nbvar· VAR Byte(16)
SEROUT 8,396,[noparse][[/noparse]"!NB0R06"]
SERIN 9,396,[noparse][[/noparse]nbvar]
DEBUG DEC nbvar
Comments
SERIN 9,396,[noparse][[/noparse]STR nbvar\3]
to get three bytes (but I haven't played with SERIN yet, so I'm not 100% sure).
Then, assuming the most significant byte is received first, the statement "value = ((nbvar(0) - "0") * 100) + ((nbvar(1) - "0") * 10) + (nbvar(2) - "0")" will convert the three-digit BCD value into a binary value.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
OS-X: because making Unix user-friendly was easier than debugging Windows