Shop OBEX P1 Docs P2 Docs Learn Events
Pls Help on this: 8 binary inputs, 1 numeric output — Parallax Forums

Pls Help on this: 8 binary inputs, 1 numeric output

merlinmerlin Posts: 40
edited 2011-07-27 04:54 in BASIC Stamp
Hi all,
I have a device who informs the internal status setting 8 pins in 1 or 0, conforming a 8 bit code number, which should be converted into a single numeric value between 0 and 255.

So I have 3 questions here:

1.- How should be the correct sentence to read the 8 binary values, supposing we are connected 8 I/O ports of my BS2 to the device?
2.- How should be the correct routine to "translate" the 8 binary values into one single numeric value?
3.- How should be the workaround to save I/O ports in BS2 using some multiplexer to do the Input reading job?

Thanks in advance, best regards


merlin

Comments

  • stamptrolstamptrol Posts: 1,731
    edited 2011-07-27 04:54
    1. You could use the INH or INL statement. See the Helpfile.
    2. To see the value returned by INL, for instance, use something like "debug DEC INL" or "debug HEX INL". It's not a matter of translation; its just how its displayed.
    3. There's a Nuts and Volts article on this on the Parallax site. Its listed as Column 109.

    Cheers,
Sign In or Register to comment.