Shop OBEX P1 Docs P2 Docs Learn Events
Reading Inputs of a Stamp PLC — Parallax Forums

Reading Inputs of a Stamp PLC

MccoyMccoy Posts: 2
edited 2005-04-30 18:22 in BASIC Stamp
Hi I've just started working with the Stamp PLC (Stamp BS2 installed).
Everthing is very easy, except reading the first digital 8 Input lines.
I got the example to work. But I need to read each point and check to see if it is·on/off.
I tried to use VAR.BIT1 thinking I could read each bit of the word gotten via the SHIFTIN command. But that·does not work.
Any thoughts would be welcomed
Thanks. Blaine

Comments

  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-04-30 13:25
    I've attached the code from my January 2004 column in Nuts·& Volts magazine.· After you do this:

    · GOSUB Read_DigIns

    ... all of the inputs are available as aliased bits (i.e., dIn1, dIn2, ... dIn10).· Make sure you call the Read_DigIns before you access one of those variables so that you have the current state of the inputs.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
    Dallas, TX· USA
  • MccoyMccoy Posts: 2
    edited 2005-04-30 18:22
    Thanks, looks like just what I needed.smile.gif
Sign In or Register to comment.