PDA

View Full Version : Command to return status of all the pins



Mziskind
08-17-2005, 12:18 AM
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.

Jon Williams
08-17-2005, 12:21 AM
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