Forum Update - Announcement about May 10th, 2018 update and your password.

Print a hex value in VGA

It seems that none of the VGA objects have a print hex method. I've tried putting one in from PST and several others but get weird numbers. What is the correct way to print a hex in VGA? I want to print time from a RTC
Thanks
Aaron

Comments

  • 3 Comments sorted by Date Added Votes
  • Use the hex method in the SimpleNumbers library object to convert the number to a hex string. Then print to VGA with the str method.

    (IMO, putting methods like hex and dec in every I/O object is a redundant waste of memory.)

    -Phil
    “Perfection is achieved not when there is nothing more to add, but when there is nothing left to take away. -Antoine de Saint-Exupery
  • avsa242avsa242 Posts: 103
    edited May 25 Vote Up0Vote Down
    Hi Aaron,

    You probably want the VGA_Text.spin object from the Propeller Tool library, or the equivalent display.vga.text.spin from https://github.com/parallaxinc/spin-standard-library, which both have hex methods.

    Usage:
    vga.hex (value, digits)
    


    Cheers,
    Jesse

    Edit: Doh! Too late...
  • Use the hex method in the SimpleNumbers library object to convert the number to a hex string. Then print to VGA with the str method.
    -Phil

    Thanks Phil that did it.
    Thanks to Jesse also.
    Aaron

Sign In or Register to comment.