PDA

View Full Version : State Machine logic testing


ngkdc
09-08-03, 03:57 PM
I'm trying to control a machine with a variable, and having no luck.

VARIABLE RUN
TRUE RUN !
MACHINE TEST
ON-MACHINE TEST
APPEND-STATE GO
IN-STATE GO CONDITION RUN CAUSES REDLED ON
THEN-STATE GO TO-HAPPEN
GO SET-STATE

I've also tried: ... CONDITION TRUE RUN @ = CAUSES ... with no success.

I've executed the in-state by typing GO ... and get an OK response with 32279 left on the stack.

Any suggestions? I can set RUN anyway necessary, since it will be a simple case statement (yea, simple once I'm shown how to do it!!!) to enable run or disable it.

When I get done, this machine will be called once per second to update an elapsed timer that doesn't reset until commanded (yet another serial port word).

Any suggestions?

***

Funny, with GOBS (1) of I/O, I'm commanding everything through the serial port ... because when done, there's gonna be a bunch of these all connected with an Ethernet-to-serial module ... digitial I/O is out of the question.


Thanks,

Rick



(1) GOBS translates to somewhere between 200-1000 units per facility.

RMDumse
09-08-03, 04:16 PM
Originally posted by ngkdc
I'm trying to control a machine with a variable, and having no luck.

VARIABLE RUN
TRUE RUN !
MACHINE TEST
ON-MACHINE TEST
APPEND-STATE GO
IN-STATE GO CONDITION RUN CAUSES REDLED ON
THEN-STATE GO TO-HAPPEN
GO SET-STATE



You're close, but need just a bit of editing. Try this.

VARIABLE RUN
TRUE RUN !
MACHINE TEST
ON-MACHINE TEST
APPEND-STATE GO
IN-STATE GO CONDITION RUN @ CAUSES REDLED ON
THEN-STATE GO TO-HAPPEN
GO SET-STATE

You had the right idea. You stored TRUE into RUN, but when you referenced RUN, you didn't get the value in it, you just tesed the address of RUN rather than the contents of RUN.



I've also tried: ... CONDITION TRUE RUN @ = CAUSES ... with no success.



Hummm... that actually looks correct.



I've executed the in-state by typing GO ... and get an OK response with 32279 left on the stack.



You aren't running the machine then. GO will get the address of the state GO, but it doesn't run the machine. So the number you got back was a memory location which would be used by SET-STATE, for instance.

The machine name is TEST. So if you say TEST you will invoke the machine and it will vector to the state that is set. But GO is not the machine, only a state of the machine.

Either run TEST by hand, or install it, or use the EVERY xxxx CYCLES SCHEDULE-RUNS TEST to set it going.

Of course, turning the REDLED OFF before hand, will give the machine a chance to set it, and make this all visible.

HTH's

ngkdc
09-08-03, 05:19 PM
It sure does help!

Figured I was close ... just couldn't get the right test case into my head. Thank you very much.