Shop OBEX P1 Docs P2 Docs Learn Events
BS1 HEX Formatting in the DEBUG statement? — Parallax Forums

BS1 HEX Formatting in the DEBUG statement?

jongarrjongarr Posts: 11
edited 2005-10-25 16:18 in BASIC Stamp
Hi,
·· I am using the parallax rfid reader to read the values from cards.· So far I have gotten good results.· I'd like to see the card values as hex characters in the debug terminal.· I looked up hex printing in the Editor Developer system (v2.1)·and saw that the $ symbol should print bytes in hex.· This is not working with my BS1 (v1.4).· The help also mentions that % will print a byte in binary format.· This does work with my bs1.· Is there another character I should be using for hex printing?

Thanks,
Jon

PS - The RFID file for the BS1 provided on http://www.parallax.com/detail.asp?product_id=28140·contains an error.· The SERIN statements are broken onto multiple lines which causes unpredictable reads in the bs1.· Condensing the SERIN lines to one line, like this fixes the problem:
·SERIN RX, T2400, ($0A), tag0, tag1, tag2, tag3, tag4, tag5, tag6, tag7, tag8, tag9
(This is also what is recommended in the nuts and volts article #120 provided on the same page)



·

Comments

  • Bruce BatesBruce Bates Posts: 3,045
    edited 2005-10-25 10:32
    Jon -

    Are you using the '{$STAMP BS1} compiler directive in the beginning of your program?

    Regards,

    Bruce Bates
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-10-25 11:58
    The BS1 has no equivalent of the BS2's HEX2 modifier.· You can DEBUG in hex, but the editor will use only as many digits as required for the value.· Do it like this:

    · DEBUG #$myValue

    The # indicates debugging the value only (sans name), the $ tells it to do so in hex.

    Unfortunately, the RFID program for the BS1 does not have enough variables to create a subroutine that would duplicate the BS2's HEX2 modifier.· You could simply put a "." between RFID bytes to separate them.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
  • jongarrjongarr Posts: 11
    edited 2005-10-25 16:18
    Thanks for the quick replies.

    For what I am doing right now, I am only trying to get the Hex output to work in a DEBUG statement.· Currently it is not working.··In my·DEBUG statements,·#% works fine, but the #$ is printing the variable name (as in printing "$tag0" to the DEBUG console).· What am I doing wrong?· Is my BS1 (v1.4) too old for printing hex DEBUG statements?

    Jon Williams - did you notice the PS in my first post?

    Thank You,
    Jon G.
Sign In or Register to comment.