Shop OBEX P1 Docs P2 Docs Learn Events
reading 24bits — Parallax Forums

reading 24bits

gtslabsgtslabs Posts: 40
edited 2007-03-16 06:27 in BASIC Stamp
I finally got my AD7730 to run. I see that the variable "WORD" is 16 bits. How do I set up a variable to receive 24 bits of decimal values?

Also,· how would I stream this in Visal Basic? Would I have to loop until I get the "CR" ascii code I have at the end·of my Debug line?

Thanks
Steve

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2007-03-16 06:27
    There are no variables larger than 16 bits although you can declare arrays and a 3 byte array would be 24 bits. The problem is that there's no 24 bit arithmetic. You can do the I/O in multiples of 8 bits just by providing multiple byte variables in the SHIFTIN statement that you're probably using. If you want to output this to Visual Basic you'll have to either write your own 24 bit binary to decimal conversion routine or possibly output it in hex since you can catenate the 3 8-bit values so they look like one 24-bit value to VB (if it can receive hex ... I haven't used it enough to know).
Sign In or Register to comment.