Shop OBEX P1 Docs P2 Docs Learn Events
SERIN to BCD array on BS2 — Parallax Forums

SERIN to BCD array on BS2

On a BS2, I have a 4 byte BCD array "INP_ARRAY" which shows up at B8, B9, B10, and B11
after an 8 byte array at origin.

If I use the "STR" special formatter in a "SERIN" command to load this array, will it refuse
to accept any bytes that are outside the range (20h - 7eh) (ASCII text)?
This would mean that BCD values for seconds, minutes, hours, and days-of-the-month
that were less than "20" wouldn't be accepted into the BCD array.

Is this my only choice:
knowing that the array is showing up at B8 thru B11,

SERIN RPin \FPin, baudmode, Timeout_Time, Timeout_Label, [B8,B9.B10,B11]

????

Comments

  • STR formatter does not refuse any bit strings. All 256 combinations are equally acceptable to it.

    FWIW, using hard-wired register names is not typically done except for BS1. Assign names with VAR and let the IDE worry about where to put them.
  • Second question:
    Can variable formatters be used on the LEFT side of an assignment?

    I'd like to use the wasted high bit (B7) in ASCII character bytes to
    signal my LCD display to "reverse-video" the ASCII character
    associated with it.
    Can I use the following code to set the B7 bit of the character byte?


    ASKEE VAR BYTE
    PTR VAR NIB
    HIGHBIT VAR BIT

    ASKEE = "A"
    HIGHBIT = %1

    ASKEE.BIT7 = HIGHBIT


    More importantly, if the ASCII bytes are in a string array, can I use
    the following code to individually set the B7 bits in the string?

    ASKEE_ARRAY(PTR).BIT7 = HIGHBIT

    thanks
  • Of course, the best way to determine if you can do something, is to try it.

    That said, I could not get the buff(ptr).bit7 past the syntax checker. You can, of course, use buff(ptr) = buff(ptr) + $80
Sign In or Register to comment.