LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

labview counter output

I’m currently using a Teknic motor driven by a counter output from an NI DAQ to control the motor speed. Right now I’m generating a pulse train where the high time and low time determine the motor speed.

Using the DAQ Assistant, everything works as expected. I can adjust the high time and low time, and the motor speed changes correctly.

The issue comes when I place the configuration inside my VI. I want to be able to change the high time and low time while the program is running, without having to stop the VI, modify the values, and restart it.

I tried implementing this using DAQmx VIs so the values could update during runtime, but it doesn’t seem to work correctly. The pulse timing doesn’t update live. In some cases the motor will slow down but never speed back up, and in other cases it won’t stop completely.

Has anyone implemented live updates to a counter output pulse (high/low time or frequency) in LabVIEW while the task is running? If so, what is the correct way to structure the DAQmx task so the timing values can be changed during execution?

Any guidance would be appreciated.

0 Kudos
Message 1 of 3
(365 Views)

Hi, 

 

You can change pulse properties on-the-fly by using property nodes.  Check this out:

 

Generate a Continuous Digital Pulse Train With On The Fly Frequency Control
https://knowledge.ni.com/KnowledgeArticleDetails?id=kA00Z0000019O8GSAU&l=en-US

 

BR

John

 

Add motion to LabVIEW in 30min or less - TENET EMotion
Finding it hard to source legacy NI hardware? Try Extend Test

Message 2 of 3
(330 Views)

When programmed correctly, output pulse parameters *CAN* be changed on the fly.  Based on the screencap you posted:

 

1. You should NOT clear your task inside the main loop!   You correctly created and started it *before* the loop, you need to wait until *after* the loop terminates before you clear it.

 

2. The code you posted shows no method for freq or duty cycle to change during the loop.  Th initial values become loop constants at the tunnel that brings them into the loop.  All you can do is keep writing those same values whenever the shift register changes (which I would suppose might be possible in the unshown "False" case?)

 

3. Your query of "is task done?" suggests the use of a *finite* pulse train.  It always used to be the case (and I suspect it probably still is) that you can't change pulse parameters on the fly for finite pulse trains, only for continuous ones.  The reason is that for finite pulse trains, DAQmx sets up its own internal timer for generating the pulse train based on a calculation with the # pulses and the initial pulse params.

 

 

-Kevin P

ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.
Message 3 of 3
(210 Views)