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.
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.
03-03-2021 08:37 AM
Hi everyone, i just want to handle two serial ports, both will continuously sending bytes at 2.5 ms. Code suggestions required.
03-03-2021 08:41 AM
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?
03-03-2021 08:46 AM
i am stuck at what type of logic do i use ? should i use two timed while loops in parallel ?
03-03-2021 08:52 AM
@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
03-03-2021 08:54 AM
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!
03-03-2021 09:53 AM
can u please explain notifier and queue ?
03-03-2021 09:54 AM
Ok thanks for your suggestion