Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

switch output between counter and tristate

Hello,

 

I am looking to solve the following problem:

I need to output either "low" voltage or high Z on a digital output line. From what I understand so far, a counter can only output "high" and "low", and in order to change it to tristate the task has to be cleared. This means that if I want to do it in a loop, I will have to redefine the whole task each iteration.

Is there any other more elegant solution to this?

(I am using a USB-6229 DAQ)

 

Thanks a lot in advance 🙂

 

Michal

0 Kudos
Message 1 of 6
(6,766 Views)

Hey Michal,

 

Unfortunately I think the only way how to set counter to be in High impedance is either cleat task or set counter to input mode (not output). I can't see other, nice or elegant solution Smiley Mad

 

regards,

stefo

Certified-LabVIEW-Developer_rgb.jpg

0 Kudos
Message 2 of 6
(6,762 Views)

If you want to tri-state the line it has to come from a software call, but you don't need to restart the whole task to do so.  The attached code uses the DO.Tristate property along with a DO task to set the line to tri-state.

Tri-state_DO.png

 

 

Best Regards,

John Passiak
Message 3 of 6
(6,748 Views)

John,

I believe you usually without question Smiley Wink, but - will it affect counter operation as well? I mean in case you have commited counter output task, can you set the PFI output to DO-tristate? Smiley Mad

 

stefo

Certified-LabVIEW-Developer_rgb.jpg

0 Kudos
Message 4 of 6
(6,736 Views)

Hi Stefo,

 

Thanks for bringing this up--my post isn't using the counters but instead is using a Digital Output task.  If Michal wants to alternate between low voltage and tri-state there isn't really a purpose to use the counters so this is what I would recommend.

 

It's actually pretty tricky to tri-state a counter output task.  Calling DAQmx Tristate.vi attempts to route "Tristate" to the PFI line, but when you're using a Counter Output task this route would already be reserved.  You can tri-state the line on X Series by configuring a watchdog task to timeout and set the line to tri-state, but I couldn't find a good way to turn the line back to output without restarting the counter task.

 

 

Best Regards,

John Passiak
0 Kudos
Message 5 of 6
(6,722 Views)

Thanks, John 🙂 

The diagram you sent looks like what will do the trick... I don't need the line as counter, so I will just do this with DO task.

Can't check it right now (not working, sick a bit...), but it looks promising.

 

Have a nice week, everyone 🙂

 

Michal

 

0 Kudos
Message 6 of 6
(6,697 Views)