Hi all,
I’ll precursor all of this by saying I’m not particularly experienced with DAQmx and NI instrumentation, so please bear with me and feel free to point out anything obvious you think I may have missed, as I probably have.
I’ve got an NI-6036E multifunction DAQ card and I want to generate various pulse trains whereby I know exactly how many pulses have been generated. However, I’m having trouble devising a way of accurately generating a pulse whereby:
- The number of pulses to send is known before the task is started
- The task may be interrupted before it finishes
- Pulse frequency will vary from 0Hz - 1kHz
I’ve attached some example code I’ve put together that almost does work as well as I need it to. I’ve set up Counter 0 as a continuous pulse output and it’s pause trigger is set to the internal output of counter 1. Counter 1 is set to edge count, and its edge count terminal is set to Ctr0InternalOutput. By reconfiguring Counter 1 initial count and setting it to count down, the pulse generation task then pauses on Counter 1’s terminal count event and the number of generated pulses is counted throughout.
The problem I’ve got though, is that the hardware set up I’m interfacing to is expecting counter 1 to generate the pulses. When I set up Ctr1 as the pulse generator and Ctr0 as the pulse counter in my attached example, I get errors about hardware routes not being supported for setting Ctr0’s edge count terminal as Ctr1InternalOutput. I assume this is a restriction of the NI-6036E hardware as the same code runs without error on other NI DAQ cards.
Is there something else I can do in software to achieve the result I am after? Perhaps by designating different pins or using a different method? I really don’t want to modify the hardware setup for (my) software shortcomings but will if I need to.
Many thanks,
James