01-06-2009 05:11 PM
Hi,
I just started using the statechart module (8.6) and I'm having some difficulty. I believe my statechart should be asynch because it will rely on discrete I/O for triggers and what not, but I'm not 100%.
Some of my states have 2 possible transitions leaving the state: 1 is based on whether it gets a certain value from the hardware input, and I want the 2nd transition to occur if the proper value from the hardware input does not arrive withing a specified amount of time. Should I create a timer function withing the action of the transition/state, or should the timer function be in the calling VI. I made an initial attemp to create a parallel loop in the calling VI with a timer function that is activated by a statechart output and then sends an external trigger back to a statechart transition...but it's not working.
I searched the forum and couldn't find anything similar. Any suggestions would be greatly appreciated; and if someone has done such a thing, some simple example code would be even better.
Thanks in advance,
Mike
01-06-2009 08:52 PM
01-07-2009 08:05 AM
Adnan, thanks for the tip. I may have been making it more complicated than it needed to be. I've attached a simple program which I think is working the way I want it to. The statechart is synchronous because I can't seem to get an asynchronous statechart to run (but that's another issue). The statechart enters State 1; if the input string is equal to 1111 within the Time Target input, it transitions to State 2; if it does not equal 1111 within the Time Target input, the statechart terminates.
This is basically what I was trying to do, but I will attempt to make it a little more elegant in my full statechart. Please let me know anyone see's any major flaws.
Thanks again.
01-07-2009 12:51 PM - edited 01-07-2009 12:52 PM
Hi Mike,
I looked at the program. It looked like it would accomplish what you wanted. The only thing that I saw was that you are sending a constant "0000" into the string value. This was done on the block diagram of the main VI. When I deleted this constant the program worked like you described it. Did you have any other questions regarding this issue?
01-08-2009 06:38 AM