LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

parallell execution?

Hi!

Im making a program that communicates with a hardware
via serial port. It want the program to read data continously and in parallell I want to send data to
hardware at special command.
I cant make a attached similar testprogram to work my way.
As long as program beeing i the readwhileloop(sending data), program
wont answer at any other command!

How can this be solved?

thanks fredda
0 Kudos
Message 1 of 6
(4,156 Views)
Hello fred,

if you want parallel execution, then you have to program it... See the attached example.

Btw you should always use delays in loops, even in examples.
When doing communication with the serial port, you should not mix up read and write accesses. The port gives you answers to your write access in a certain order so you have to check those also in a certain order. So you should put the serial port comm stuff in a subvi that is non reentrable (VI properties -> execution -> reentrant switched off) to avoid mixed port access. You can find many examples for this in the forum, look for device drivers (for instance Votsch climate chambers with serial port communication).

Best regards,
GerdW
Best regards,
GerdW


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

Yes, I know that the writing en reading must be i
in a certain order.

I want the hardware to change its sending signal
when it gets a recieving commandstring with
different parameters. I want the program to read continously but write only on command, not continously.

With my attached file I really dont know if the
hardware "answers" the command (dup visa resource wiring). And, it can only write the command when there
is incoming data to read. I want it to be able to
write even if there is no incoming data.

Please help

Se my attached file. Change it if you like.

Thanks
0 Kudos
Message 3 of 6
(4,156 Views)
Hello fred,

your While loop looks good...
Why can't you differ between normal read and answers to commands? First you write the command, then you read the answer. If "send command" is false, then you have a normal/continous reading.
If you just want to write commands, then you have to introduce a case structure around the VISA read. Make a boolean switch "Just write command" and wire this to the case selector.
I attached an older example of serial communication (made for Vötsch Climate chambers). It uses the old serial port vi's, but you can do the same with VISA. Just replace with appropriate vi (Read, Write and Bytes at Serial Port, all in VISA->Advanced->Serial).

Best regards,
GerdW
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 6
(4,156 Views)
Hi!

No I cant differ because there is only
one type of read, a signal. Its the signal itself
that will change when it get that "changecommand"!

I cant make my program work my way for the moment..

/Fredda
0 Kudos
Message 5 of 6
(4,156 Views)
Hello Fredda,

so your problem is (kind of) independent of the serial communication. You have to track the signal and test for a (significant) change. Maybe you can try arrays and use moving average for detection...
What kind of device is it? Maybe some people in the forum have used it too and are able to help? It seems te be a rather simple logic, if it only gives you an output signal.

Best regards,
GerdW
Best regards,
GerdW


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