View Full Version : Storing Multiple Characters in a Variable

08-09-2008, 11:01 AM
· I'm using the HB-55B Compass Module and it works fine so far.· The trouble I'm having is trying to store the
compass cardinal readings ("N","NW","S","SW",etc..) in a Word-sized variable.· How do I store a character string?
····· ·Thank-You.

Mike Green
08-09-2008, 11:13 AM
You could do: v = "W" << 8 + "N" or v = " " << 8 + "N"

It's not really a character string, but it is two characters.
You could treat it as a two byte array and use the STR formatter like:
SEROUT <pin>,<Baud>,[ STR v\2 ]
I think this'll work.

08-09-2008, 12:37 PM
Thank-you Mike. Always helpful....