Shop OBEX P1 Docs P2 Docs Learn Events
Command to return status of all the pins — Parallax Forums

Command to return status of all the pins

MziskindMziskind Posts: 9
edited 2005-08-16 17:21 in BASIC Stamp
Is there a PBASIC command or way to return the status of all the pins? I'm trying to monitor sensors, and was looking for a command that would return a binary string, so I wouldn't have to have 16 IF statements. Thank you.

Comments

  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-08-16 17:21
    Assuming all your pins are configured as inputs, you get read them with one line of code:

    · theInputs = INS

    INS is a 16-bit register that holds the current state of the inputs; INS.BIT0 holds P0 status, INS.BIT15 holds P15 status.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
Sign In or Register to comment.