02-09-2018 01:53 AM
Hi All,
I am trying to implement a series of timed sequences with an offset for each of them. I have attached the labview file for reference. Each sequence is to control a specific vibration motor (turn it on and turn it off). They use a non-re-entrant sub-vi to either turn a specific motor on or off. Each successive vibrator has an offset of starting to the previous one, but it will normally start before the previous one finishes (have some overlap time where more than one is vibrating. When call this sub-vi (without the while loop that is currently surround it) the first time it works well, but each successive time I call it the offsets do not correctly work. Likewise if I run It in a loop (like it is currently set up) it will work the first time correctly but not each successive time. I have tried playing with the timer source to reset each time but that makes no difference. Is anyone able to help me as to why this would be happening and/or an alternative way to program this? Ideally I would like it as a sub-vi
Regards,
Ben
02-09-2018 03:51 AM
02-09-2018 04:15 AM
Hi Gerd,
My understanding is the name is for the timing source, not the actual sequence, so that they all operate off the same timer (hence offsets will be relative to each other). Is that not correct?
Also I cannot use wait functions because the duration and time between vibration motors are them is variable so they may not always be in the same order. (i.e.) it may be turn 1 motor on, then turn 2 on then 1 off then 1 off etc. Or it could be turn 1 motor on, then turn 2 then three on, then 1 off etc. My understanding is the wait functions lock up the whole function, so nothing else can run in that function while the wait is happening.
Regards,
Ben
02-09-2018 04:54 AM
Hi Ben,
my context help calls that input "Structure name".
I don't know why you think it denotes the timing source…
Also I cannot use wait functions because the duration and time between vibration motors are them is variable so they may not always be in the same order.
A state machine (or queued message handler) may help here too: you just need to convert all your delays to a kind of table describing which event is to be processed next at which time.
Example:
motor1 on
wait 2ms
motor2 on
wait 3ms
motor1 off
wait 20ms
motor2 off
02-09-2018 05:10 AM
Sorry I got confused with the structure name because in the help for the timing source it talks about if you have the same timing source name then they will be in phase with each other. However, I got this confused with the structure name because I was unable to give a name to the timing source. Thank you for pointing that out.
I will have a look at the state machine.
Thanks,
Benjamin