07-28-2009 04:39 AM - edited 07-28-2009 04:43 AM
hi,
i searched this, found some related topics but i still couldn't solve my problem.
actually i don't really need a real parallel programming.
i just have simple test procedure and have an i/o card communicating via serial port.
i prepared the communication vi, i can read inputs and write to output pins of the io device.
but in the whole program, i have put some waits about 5-45 seconds.
when the program executes the wait(ms) command, my io module vi does not work so
my communication with the module breaks off.
so i can not sense the changing inputs during this time.
how can i communicate via rs232 and run my test sequence simultanously?
or is there a timing method that does not stop the sequence?
i am not very familiar with labview, but when programming PLCs, the timers does not stop the execution of the
commands after them. the cyclic operation continues, when the preset time elapses, the timer gives a contact.
may be if there is a similar method, it can be helpful for me.
thanks.
07-28-2009 04:53 AM
07-28-2009 06:29 AM - edited 07-28-2009 06:32 AM
hi GerdW,
i had to use a sequence like this, and all this case is located in a while loop.
when the user clicks the start button, the sequence steps executes one time.
i used the error lines to ensure the same linear execution.
the booleans are used in the steps. but as i said, i can not get the online data from the module because of the delays.
the delays are necessary because the product we are testing needs them.
for exp it becomes ready 40 secs after power-up.
but i need to read the inputs during this time too.(for exp for the stop button, emg stop, ect)
i would be pleased if you could give me some advice about this.
thanks.
07-28-2009 06:42 AM
07-28-2009 06:48 AM
thanks muks,
i will have to do it as you said if can not find any other solution.
but i wanted to write a standart i/o access vi and use it in my other apps.
07-28-2009 06:53 AM - edited 07-28-2009 07:00 AM
Hi tonay,
the standard recommendation for such cases also applies here: use a state machine and a parallel loop for the GUI handling!
In the picture you show 3 execution states plus a "wait" state between them. Make a state machine with a case for each state. For the wait state I would use a loop with only a short wait to enable fast reaction to GUI events...
And please replace that boolean array to cluster to unbundle by one simple index array function (RubeGoldberg)!
07-28-2009 07:16 AM
thanks, i'll study the state machines first.
as i said, i am just a beginner 🙂
07-28-2009 09:50 AM
ok, state machine works well 🙂
but now i have to simplify it.
it is still goldberg:)
i made an example program with 100 ms delays, so for a 1sec delay, i had to use 10 states.
for higher resolution and longer delays, it will be almost impossible to apply.:)
you said you would use a for loop.
how should i use the for loop in the state machine for my example?
here is my example program, the button simulates the user actions and serial comm etc.
the indicator immediately reacts to the button now.
07-28-2009 10:05 AM - edited 07-28-2009 10:09 AM
Hi tonay,
now you have a state machine with 20 wait states for each 100ms. Fine, but not very useful...
I changed your vi to have one state, which is the wait state. Here you find a FOR loop which can be interrupted prematurely by an external condition (it doesn't has to be a control button!).
Please mark your LV version when asking for help, it greatly helps to know which version you use beforehand...
Edited:
Changed vi to look like a state machine Changed enum too...
07-28-2009 10:39 AM
thanks GerdW,
did i miss something?
in my vi, when the slide indicator continues to fill (simulating my test seq)
whenever i click the user button, the led reacts immediatelly. (simulating the user actions or serial com etc)
thats what i want.
in the vi you sent, when i click the button, the led waits the slider to fill.
i click the user button, and the led indicates it 10 secs later.
i want it to indicate at the time i press the button.