LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

parallel programming

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.

 

 

 

 

 

Message Edited by tonay on 07-28-2009 04:43 AM
0 Kudos
Message 1 of 11
(4,362 Views)

Hi tonay,

 

a wait command stops the structure, where it is located in. So don't use sequences to avoid stopping at frame borders Smiley Wink

 

Put the serial communication in a parallel loop to get parallel computing!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 11
(4,354 Views)

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.

 

 

 

vi.jpg

Message Edited by tonay on 07-28-2009 06:32 AM
0 Kudos
Message 3 of 11
(4,333 Views)
You can use visa read function multiple times. Use a read function after each delay. and close it once outside the loop.
0 Kudos
Message 4 of 11
(4,322 Views)

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.

0 Kudos
Message 5 of 11
(4,313 Views)

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)!

Message Edited by GerdW on 07-28-2009 02:00 PM
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 6 of 11
(4,311 Views)

thanks, i'll study the state machines first.

as i said, i am just a beginner 🙂

0 Kudos
Message 7 of 11
(4,300 Views)

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.

 

 

0 Kudos
Message 8 of 11
(4,276 Views)

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 Smiley Wink Changed enum too...

Message Edited by GerdW on 07-28-2009 05:09 PM
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 9 of 11
(4,273 Views)

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.

 

0 Kudos
Message 10 of 11
(4,261 Views)