From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

VISA serial

Hi everyone, i just want to handle two serial ports, both will continuously sending bytes at 2.5 ms. Code suggestions required.   

0 Kudos
Message 1 of 7
(1,028 Views)

Hi Akbar,

 


@Akbar7110 wrote:

Hi everyone, i just want to handle two serial ports, both will continuously sending bytes at 2.5 ms. Code suggestions required.   


You already have a VI to handle one COM port? Set this VI to reentrant, then call it twice…

 

You really need to learn to ask better questions!

 

How is "using two ports" related to transmission volume ("sending bytes at 2.5ms")?

How do you want to time those "2.5ms" on your Windows (?) computer?

What have you tried so far? Where are you stuck?

Is there any specific problem/question?

Best regards,
GerdW


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

i am stuck at what type of logic do i use ? should i use two timed while loops in parallel ?

0 Kudos
Message 3 of 7
(1,023 Views)

@Akbar7110 wrote:

i am stuck at what type of logic do i use ? should i use two timed while loops in parallel ?


No need to use Timed Loops.  Just two simple While loops will do.  Of course, your stopping logic will become a little more difficult since you need to control both loops.  Depending on the rest of your code here, I would probably use a Notifier and have a control loop (While loop with an Event Structure in it) send the Notification when you want to shutdown.  Based on my typical systems, I have a queue for each loop and I send the shutdown commands through the queues.

 

Shameless plug: VIWeek 2020/Proper way to communicate over serial


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 4 of 7
(1,020 Views)

Hi Akbar,

 


@Akbar7110 wrote:

i am stuck at what type of logic do i use ? should i use two timed while loops in parallel ?


You still need to learn to write better questions!

You still forgot to provide a lot of background information so there will be no way to give senseful answers to your generic questions…

 

Which target should your VI run on? Using TimedLoops on a plain Windows is (mostly) nonsense. Using TimedLoops for non-deterministic processes (like serial port communication) is (mostly) nonsense…

 

Using two parallel loops to handle two serial ports in parallel is a good idea!

Best regards,
GerdW


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

can u please explain notifier and queue ?

0 Kudos
Message 6 of 7
(992 Views)

Ok thanks for your suggestion

0 Kudos
Message 7 of 7
(991 Views)