10-03-2018 03:18 PM - edited 10-03-2018 03:27 PM
Hi, I am working for Counter Outputs and I am having some problems with them. I understand the basic principles, and I understand that by default a counter will return to it's Idle State once the pulse has finished, but how do I get it to go back to its low value when I close my VI?
To be specific I am using an idle state of High. So when I run my pulse it goes to 0, and then back to 5. But when I close my VI my DAQ keeps writing a value of 5. Is there a way to just tell it to write to 0? Or to turn it on somehow? I've attached a snip of my code.
Solved! Go to Solution.
10-03-2018 03:45 PM
You can set it to whatever you want after the loop and before the clear function (unless you abort the VI, of course)
10-03-2018 03:50 PM
What block would I use for that? I have tried the DAQMX write, but if I try and write just a digital output it errors out because the channel task is for a Counter Output. And when I try for a Counter Output it just has me write a new pulse signal, which still has the idle state set to high.
10-03-2018 03:50 PM
What block would I use for that? I have tried the DAQMX write, but if I try and write just a digital output it errors out because the channel task is for a Counter Output. And when I try for a Counter Output it just has me write a new pulse signal, which still has the idle state set to high.
10-03-2018 04:00 PM
You might be bumping into a side effect of a behavior known as "lazy uncommit." (More info available by searching the forums.)
Here's something you might try:
Most PFI pins that are used for counter I/O signals can also act as digital I/O pins. You could try making a digital task that writes a 0 (or False) to that pin immediately after clearing the counter task. Note that for a digital task, you'll refer to the pin with syntax similar to "Dev1/port#/line#".
(There's another method that might work using the counter task after stopping it but before clearing it. It might seem more complicated. You'd basically take the task refnum of the stopped task and then change a DAQmx Channel property to set the idle state Low. Then you'd make use of the DAQmx State Model to put the task into the "committed" state. That'll force the counter output into its (new) Low idle state, hopefully it would stay there after a subsequent task Stop and Clear.)
-Kevin P
10-03-2018 04:17 PM
Thanks Kevin. I was able to write an On/Off value to the pin by creating a new Digital Output task in MAX. I was hoping to get away with only one MAX channel for the entire thing, but this seems to work. I did not try the property node option, but that was something I was actually already looking into if I couldn't get this simple Digital Output to work.