LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Making a Line go High and Low with a timer in DAQmx

Solved!
Go to solution

Hi I am trying to make a line go LOW to HIGH or HIGH to LOW using DAQmx, if I set a boolean as true, for a very specific amount of time. So far I managed to make it work using the following design. Working SolutionWorking Solution

 

Yet, it seems very unnecessary. Below I have attached the solution I wished to use originally, yet this never sends the line back to LOW if 'Low activated' is false or HIGH if 'Low Activated' is true. It just decides to completely ignore it, UNLESS I run the VI with highlight execution (the lil' lightbulb thingy) on.

 

Things I also tried to fix this solution below:

- passing the booleans to the write operations as the value of low activated to the first and last nodes, while the middle one was handled with a NOT operator.

- giving the boolean values as an array

- making the wait operation loop occur on the final node

- having the wait operation handled by a case structure with the 'Time's Up' value as its input.

    * If false it writes true 

    * If true it writes false and exits

None of these fixed anything, therefore I am assuming it is a timing related issue, which is odd as I use the exact same timing paradigm in other write operations (non digital) and it works fine.

Non working solutionNon working solution

 

Would anyone be able to enlighten me on this? Thank you very much!

0 Kudos
Message 1 of 6
(146 Views)

If you want to deliver timed digital pulses (which is what it sounds like you are trying to do), then you (ideally) want DAQ hardware, like the USB-6212, that has Counter/Timer outputs.  [I believe that NI recently announced the "next generation" of these devices that also feature Counter/Timers].  You want the DAQ hardware to do almost all of the timing for you (it can also "count" the pulses produced if that is a feature you need).  I think you can find more information on the Web (try DAQmx Counter/Timers as a search term).  Once you configure the Counter/Timer correctly (which is where you determine the Pulse properties (i.e. the initial "resting" state, Low or High, any "delete" to the first transition (e.g. Low-to-High or High-to-Low), pulse width, and (if you have a pulse train) how many pulses, you can fire the whole thing off on a TTL trigger or simply tell DAQmx to deliver start the timed sequence.  But you should be able to find out more details directly from NI.

 

Bob Schor

 

 

0 Kudos
Message 2 of 6
(109 Views)
Solution
Accepted by topic author PinksDP

You are always feeding true to the digital line when it is in the while loop. A better way to do this would be to do something simple like this where you are changing all of the states in the while loop:

Example.png

In this example you have a shift register that keeps track of the status of the digital output. When the time expires you change the state. This will keep running forever or until you hit stop. Also in the future when you post code make sure you save it for a previous version and make it something like 2020. Most people do not use the newest version of LabVIEW.

Tim
GHSP
Message 3 of 6
(106 Views)

Thanks for the help!

 

I know how to generate a pulse train using a counter as you mentioned. However, this isn't exactly what I want here, all I want is to set the line to high or low for a set amount of time once and then reset it to the previous state, which is what both solutions aim to do.

 

Generating a pulse a la PWM but with only one sample as you are suggesting sounds overkill? I was also considering generating a digital waveform that would go from down to up then down again and vice-versa, but that too sounds unecessary.

 

0 Kudos
Message 4 of 6
(104 Views)

Thanks! That sounds great, I'll definitely try it out! Marking this thread as solved with this.

0 Kudos
Message 5 of 6
(90 Views)

This is an easier way but I would not do it this way. I would use a state machine and a loop.

Example 2.png

Tim
GHSP
0 Kudos
Message 6 of 6
(86 Views)