Shop OBEX P1 Docs P2 Docs Learn Events
hexidecimal decimal help really needed — Parallax Forums

hexidecimal decimal help really needed

science_geekscience_geek Posts: 247
edited 2008-04-09 22:18 in BASIC Stamp
ok, so i bought this display, but its not here yet, and by the looks of it, it can only send out hexidecimal, i was wondering if the bs2 could read hexidecimal, if any one has a uoled display from 4d systems please let me know, i bought one but its not here yet and am not expecting it to come till the day before the competition im in,· if it can read hexidecimal, is there a way to convert it to decimal or can someone tell me the math to do it any help is greatly appreciated

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2008-04-08 00:46
    Which uOLED display?

    I don't think any of 4D Systems' displays produce hexadecimal. They (4D Systems) may write down numbers in hexadecimal format on paper to make it easier to explain what's going on, but the numbers are all in binary.

    In any event, the BS2 has what are called "formatters" in the SERIN and SEROUT statements (and DEBUG statements) that convert a binary value for output to a string of characters in binary, decimal, or hexadecimal format for display purposes and back the other way (from a string of characters in binary, decimal, or hexadecimal format) to binary for internal use by the program. Look at the appendix in the Basic Stamp Manual and the chapters on the SERIN and SEROUT statements for details.
  • science_geekscience_geek Posts: 247
    edited 2008-04-08 02:05
    so basically i could write 750 in hex and us the serout command send it to the basic stamp, use the serin in command and it would be able to produce it in decimal, so it doesnt matter which form i use?

    and i got the µOLED-32028-PMD3T
  • metron9metron9 Posts: 1,100
    edited 2008-04-08 03:47
    http://en.wikipedia.org/wiki/Hexadecimal

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Think Inside the box first and if that doesn't work..
    Re-arrange what's inside the box then...
    Think outside the BOX!
  • science_geekscience_geek Posts: 247
    edited 2008-04-09 21:37
    that link didnt help much, i know hex i dont know if its possible to send out hex and receive it as decimal, unless the basic stamp can handle hex, can it
  • marzec309marzec309 Posts: 146
    edited 2008-04-09 22:18
    Yes the basic stamp can handle hex.

    The answer your looking for is yes. But it doesn't really matter everything is handled in Binary, you'll just have make sure you convert it to hexadecimal To make sense out of it. What I'm trying to say is every Micro Controller works in binary. So when you use hex in your program its still a Bin number just changed to a different format so you can understand it. so when you send out a hex number it is transmitted in Bin, and when you receive it it will be in bin format, and can be formated in to Dec, Hex or left Bin. But this is not a problem for the basic stamp. and you should be in good shape.

    The main reason to this big mess as you probably already know is

    Dec 16 = Bin 10000
    Hex 16 = Bin 10110

    So when you work with hex you have to always use the prefix so the program understands or the actual data wont be what you expect, because the controller actually handles that value in Bin.


    Well thats my two cents Hope it helps.
Sign In or Register to comment.