Shop OBEX P1 Docs P2 Docs Learn Events
Tracy Allen''s state machine — Parallax Forums

Tracy Allen''s state machine

ArchiverArchiver Posts: 46,084
edited 2002-09-23 09:23 in General Discussion
Hello Stampers,

Sorry for the bad English, I live in the Dutch speaking part of Belgium

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.

A BS2P40 has to do the job because I want to "deactivate" the system with an
iButton.

Monitoring 16 inputs with If Then loops is "spaghetti" programming, so I
studied Tacy Allen's 'Case of doors" project at
http://www.emesys.com/BS2fsm.htm#doors.

I think I can use this approach, but need a solution for next problem:

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)

I know I can use the example but the action to take by an open or closed
door will only take place after the door has changed its state.

Anybody knows a "clever" solution for this problem?

Thanks,


Met vriendelijke groetjes,

> ************************************************
> Michel De Meester
> Biotechnisch Onderhoud
> Universitair Ziekenhuis Antwerpen
> Wilrijkstraat 10
> 2650 Edegem - B
> tel: ++32 (0)3 821 36 47
> e-mail: michel.de.meester@u...
>
> *************************************************
>
>
Sign In or Register to comment.