12-10-2021 01:55 AM
Hello All,
I am trying to develop a vi that used to send multiple commands through a serial port. The commands must be sent at a specified interval. Like Data 1 must be sent at interval of 250ms, Data 2 must be 2000ms, Data 3 must be 1000ms, and so on. I have developed the vi and inorder to check that vi I have added an incremental factor.
The incremental factor will be incremented by 1 based on which Data is triggered. For example, if the Data 1 is triggered at 250ms it will be added 1, so at every 250ms the value will be incremented by 1. The loop time is 100ms.
I am facing a problem, every time I run this vi the incremental factor for Data1 is increasing by 14 times.
I need to resolve this issue. I have attached the vi for your reference.
Expecting the positive response. Thanks in advance.
Thanks,
Karthik
12-10-2021 03:07 AM
You've got a wait until next ms multiple of 100 in the loop, 250/100 = 2.5, (there is a remainder) Data1 will always mess up.
you need a loop timer that divides into all of your data times.
50 or 250 should do you. (I'd go 50) as you won't miss a 250 from there.
Then with your loop running faster than the smallest data time you determine if you need to send a signal.