Tracy Allen''s state machine
Sounds like you need to store the initial (non-alarm) state of the sensors
in the EEPROM and then compare the actual inputs to this state to see if
something is wrong. Check out the DATA command in the Stamp manual.
Original Message
> I'm working on a "big" car alarm for use in a "RV" and have to monitor 16
> inputs, some are active low (fed by an optocoupler for 12 volts detections
> or push buttons), some are active high (by reed contacts), the hardware is
> already made so I can't change these things.
>
> When the program starts the first time it reads the input states in X0,
> thereafter it reads the input states in X1 and then compares X0 with X1,
by
> doing this it can detect a change in state of a door.
>
> But if no door chages its state, the program doesn't know wich state the
> doors are initial in and will never brach to the "firstdoor,
> seconddoor........." labels.
>
> How can I detect the initial state of my inputs (this is important, I must
> know if the step is still open, I have forgotten to remove the external
> power line, the door of the cargo space is still open etc.) and take
proper
> action (sending the info to an LCD screen on the dashboard after turning
the
> ignition key)
>
in the EEPROM and then compare the actual inputs to this state to see if
something is wrong. Check out the DATA command in the Stamp manual.
Original Message
> I'm working on a "big" car alarm for use in a "RV" and have to monitor 16
> inputs, some are active low (fed by an optocoupler for 12 volts detections
> or push buttons), some are active high (by reed contacts), the hardware is
> already made so I can't change these things.
>
> When the program starts the first time it reads the input states in X0,
> thereafter it reads the input states in X1 and then compares X0 with X1,
by
> doing this it can detect a change in state of a door.
>
> But if no door chages its state, the program doesn't know wich state the
> doors are initial in and will never brach to the "firstdoor,
> seconddoor........." labels.
>
> How can I detect the initial state of my inputs (this is important, I must
> know if the step is still open, I have forgotten to remove the external
> power line, the door of the cargo space is still open etc.) and take
proper
> action (sending the info to an LCD screen on the dashboard after turning
the
> ignition key)
>