06-19-2025 06:57 AM - edited 06-19-2025 07:09 AM
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 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 solution
Would anyone be able to enlighten me on this? Thank you very much!
Solved! Go to Solution.
06-19-2025 08:50 AM
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
06-19-2025 08:56 AM
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:
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.
06-19-2025 08:58 AM
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.
06-19-2025 09:01 AM
Thanks! That sounds great, I'll definitely try it out! Marking this thread as solved with this.
06-19-2025 09:11 AM
This is an easier way but I would not do it this way. I would use a state machine and a loop.