LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Read Data through RS232 4 Serial port and VISA parallely

Solved!
Go to solution

Hi Vinay,

 

how can I control that 1st serial read and write has to read COM PORT 1 and 2nd serial read and write has to read COM PORT 2 

By setting the correct VISA reference values…

 

Did you do any of those free learning resources offered for free in the header of the LabVIEW board?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 11 of 23
(1,638 Views)

Dear GerdW,

 

Did you do any of those free learning resources offered for free in the header of the LabVIEW board?

actually No. but I learnt LabVIEW  basic by LabVIEW resource which I got online Basic 1 and Basic 2 

plz guide me if its there any free online tutorial for labVIEW from NI

 

Regards,

Vinay

0 Kudos
Message 12 of 23
(1,633 Views)

Hi Vinay,

 

plz guide me if its there any free online tutorial for labVIEW from NI

I repeat: those free learning resources offered for free in the header of the LabVIEW board!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 13 of 23
(1,629 Views)

hooking up four devices to four com ports and querry/receive data in parallel is easy, but I guess it depends on how "parallel" you are hoping for.

 

I have done this with three wattmeters that communicate with rs-232 in one of my tests.


3y.PNG

Now in theory with the VI's set to "preallocated clone reentrant execution" these three device should be read in parallel, but they are not. They are actually read in a seemingly random order each time.

 

I suspect VISA is serializing the serial port access and a race condition sets the order they are read, but that's just an uneducated guess.  

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 14 of 23
(1,604 Views)

Hello GerdW,

 

I have done some work for parallel visa read

please have a look and let me know weather I am going good

I cant able to attaché VI because my system doesn't allow to attaché the VI so I attached VI picture 

Message 15 of 23
(1,594 Views)

Hi Vinay,

 

you're on the right track…

 

Some comments:

- Don't open and close the COM ports in each iteration of your loops. Open once BEFORE the loop, close ONCE after the loop…

- You initialize the COM port to support a (default) TermChar: don't use BytesAtPort then! Just read more bytes than your largest message will need…

- As long as you use BytesAtPort you need to add an additional wait function in the loop. But using BytesAtPort is wrong anyway…

- I would suggest a larger timeout value for your COM port initialization…

- I would parse the COM port alias in a more robust way…

- Clearing the COM port buffer with each iteration usually only leads to loss of data and incomplete messages!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 16 of 23
(1,596 Views)

thanks for replay GredW

 

I have changed VI based on your suggestions and attached

 

I have some questions below

 

I would parse the COM port alias in a more robust way...

I really didn't get what alias mean. I feel its basic thing but sorry I don't know

 

thank you for your support

have a nice day

0 Kudos
Message 17 of 23
(1,587 Views)
Solution
Accepted by Vinaygowda

Hi Vinay,

 

I would parse the COM port alias in a more robust way...

Right now you find all VISA resources and convert the array into a single string.

Then you search for e.g. "COM3" in this string and use the found "COM3" again to open the VISA resource.

Why do you even search for COM3 when you use this anyway to open the port?

Why don't you handle "not found" conditions???

 

I have changed VI based on your suggestions

- As you don't use BytesAtPort anymore (which is good!) you don't need to put a wait function into the loop: VISARead will wait on its own when receiving messages…

- You can connect the error wire directly to the stop condition of the loop(s)!

- You don't need to clear the COM port buffer before closing the port…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 18 of 23
(1,583 Views)

hello GredW,

Why do you even search for COM3 when you use this anyway to open the port?

because I need different VISA read function to open specific com port. any way I using NI rs232/4 serial port device to connect so I ll connect 1st machine to port 1 and 2nd machine to port 2 so on. then com port number will be same and 1st row of visa read will read only from COM 3 and 2nd row must read from COM 4 

please correct me if I am wrong

 

Regards, Vinay

 

0 Kudos
Message 19 of 23
(1,580 Views)

@RTSLVU Hi, I'm looking for information to Yokogawa wattmeter and if I well understand maybe you use the same as I. It's an old WT230 and I have problem not to send request but to keep back query. Can you contact me about this ? Thank you to help me to solve my problem. You can contact me by MP. Rgs Vr0.

0 Kudos
Message 20 of 23
(82 Views)