View Full Version : Creating several state-machines
I have a problem with creating several state-machines. I have created three state machiines. One which should gather sensor signals, one which should send these sensor signals to another computer via sci1 and one which should receive new PWM signals from this computer via sci1. But my problem is when installing these state machines. Depending on which state machine I install first some of the state machines does not work. One problem that I have detected is when installing SEND as the last state machine. Then the ACT does not receive new sensor signals and SCI RX? will return 50 because the buffer is full. The program can be seen at: www.kom.auc.dk/~rchr04/aau.txt and hope that some one could tell me if I am doing something wrong with the way I am creating state machines or with the way I INSTALL them. I do not think that it is a problem with the code itself, byt maybe with the way i create or install the state machines.
RMDumse
05-21-07, 01:57 PM
...hope that some one could tell me if I am doing something wrong with the way I am creating state machines or with the way I INSTALL them. I do not think that it is a problem with the code itself, byt maybe with the way i create or install the state machines.
I several small problems, but no known killers, yet.
I see you do a tremendous amount of processing in transitions, and some of the transitions are trivial, meaning a thread would be as useful as a machine.
So here's a suggestion. You are thinking it is the way you are creating state machines or the way you are installing them. I suspect that is not the case. So let's do a test. Strip out the long code, leave only the minimum state structure, install that, and see if it runs okay. That will at least eliminate or confirm your fears.
After we know where to look, we can then tackle other issues.
I actully made it work. I installed the machines as a chain:
SAMPLE SET-STATE
SENDE SET-STATE
ACTUATOR SET-STATE
MACHINE-CHAIN MACH
SAMPLES
SEND
ACT
END-MACHINE-CHAIN MACH
INSTALL MACH
This made it work.
vBulletin v3.0.7, Copyright ©2000-2012, Jelsoft Enterprises Ltd.