LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

How to use DAQmx_CO_Pulse_IdleState or DAQmxSetCOPulseIdleState

I'm thinking of using DAQmxSetCOPulseIdleState(..., DAQmx_Val_Low) for 0% duty cycle, and DAQmx_Val_High for 100%.

The attribute is only settable when the task is not running (btw: any way to get from DAQmx whether a task is running or not? Since it's never 'done' when using DAQmx_Val_ContSamps timing). So when 0% or 100% is needed the task is stopped and I set the idle state.

 

The problem is, my PCI-6013E doesn't care. If I stop the counter output task, the output always goes to 0V (and then 5V after DAQmxResetDevice).

 

So, does this work with newer cards only - and if, which ones?

-----------------------
/* Nothing past this point should fail if the code is working as intended */
0 Kudos
Message 1 of 6
(4,094 Views)

Hi,

 

why exactly do you want to set th Idle State? 

 

E, M and S-Series cards do not support setting the Idle State while the task is running.

 

Solution: Simply set the Idle State before you start your task.

 

Hope this helps,

Andreas Stark
LabVIEW Lead @ Rocket Factory Augsburg
0 Kudos
Message 2 of 6
(4,062 Views)

Why? 100% duty cycle = task stopped, idle state high; 0% = task stopped, idle state low. I assumed it's supposed to work this way.

 

I know that I have to stop the task, there's an error if I do it while the task is running.

 

And you can't set it in advance, that is before you start a task, because one doesn't know, if the next needed duty cycle is 0% or 100% or x%...

-----------------------
/* Nothing past this point should fail if the code is working as intended */
0 Kudos
Message 3 of 6
(4,047 Views)

Hi,

 

I don't understand how you came to the conclusion 0 or 100% duty cycle would stop the counter output task?

 

Idle State is the behaviour of your card if a task is stopped but not cleared (see this).  Depending on your application you might need to set your power-on states. We do have cards that support this feature, unforunately the PCI-6013E does not (check E-Series manual, p. 4-9). Please contact our sales department for help selecting the right card for your application.

 

If you need some additional information on the DAQmx programming concepts, please refer to this or the DAQmx help (Start»All Programs»National Instruments»NI-DAQ»NI-DAQmx Help.)

 

Unless you provide further information what exactly you need to get done I cannot provide more support to you.

 

Best Regards,

Message Edited by AndreasS on 04-20-2010 11:11 AM
Andreas Stark
LabVIEW Lead @ Rocket Factory Augsburg
0 Kudos
Message 4 of 6
(4,014 Views)

Thanks for your answer. I see now, that I wrote pretty unclear. I hope this is better:

 

 I know that 0% or 100% duty cycle don't stop the task. Setting these values result in an error and the task keeps running with the previous setting. So I thought that I can do 0% or 100% by stopping the task and setting the idle state to either low or high.

 

There was no error but the PCI-6013E didn't 'care' about the settings. I wondered whether my assumption was wrong what the idle state is supposed to do, or that the E-Series just couldn't do different idle states. Thus my post.

 

You're saying the idle state feature is only supported on some cards, right?

-----------------------
/* Nothing past this point should fail if the code is working as intended */
0 Kudos
Message 5 of 6
(4,000 Views)

Hi,

 

here are your answers:

 

  1. 0 or 100% are not possible, the duty cycle has to be between 100.0e-9 (which is as good as 0) and 999.999900e-3 (which is as good as 1)
  2. If you need a total clear 0 or 1, you need to stop your task but not clear it => now your card is in idle state
  3. You need to set the idle state before running the task, so you must decide if you either want to have a clear 0 and only a 0,9999999 instead of 100% or if you want a clear 100% and "only" a 0,0000001 instead of 0%
    either way I dont think you can actually see a difference

I hope this makes it clear for you.

 

Best Regards,

Andreas Stark
LabVIEW Lead @ Rocket Factory Augsburg
0 Kudos
Message 6 of 6
(3,996 Views)