Shop OBEX P1 Docs P2 Docs Learn Events
splitting 12 bit values into two variables, 8+4 — Parallax Forums

splitting 12 bit values into two variables, 8+4

evergreenevergreen Posts: 43
edited 2006-08-06 19:00 in BASIC Stamp
Hello,

I have a 12 bit ADC, and I'm trying to save the values into the 25LC640 EEPROM. How do I split the 12 bit values into a 8 bit variable and a 4 bit variable for storage, and then reconstruct it when I went to read? I'm using a BASIC Stamp 2.

Thank you very much!

Comments

  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-08-06 19:00
    Hello,

    ·· You will actually have to use a 16-bit variable and save it as two bytes.· The upper bits will be ignored.· I hope this helps.· Take care.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
Sign In or Register to comment.