Documentation

Generate Data on a Counter Channel

Use addCounterOutputChannel

Use the addCounterOutputChannel method to add a channel that generates pulses on a counter/timer subsystem. You can generate on one channel or on multiple channels on the same device using startForeground.

Generate Pulses on a Counter Output Channel

This example shows how to generate pulse data on an NI USB-9402 with device ID 'cDAQ1Mod5'.

Step 1. Create a session object and save it to the variable s:

s = daq.createSession('ni');

Step 2. Add a counter output channel with a PulseGeneration measurement type:

ch =  addCounterOutputChannel(s,'cDAQ1Mod5', 0, 'PulseGeneration')
ch = 

Data acquisition counter output pulse generation channel 'ctr0' on device 'cDAQ1Mod5':

       IdleState: Low
    InitialDelay: 2.5e-008
       Frequency: 100
       DutyCycle: 0.5
        Terminal: 'PFI0'
            Name: empty
              ID: 'ctr0'
          Device: [1x1 daq.ni.CompactDAQModule]
 MeasurementType: 'PulseGeneration'

Step 3. Generate pulses in the foreground:

s.startForeground;
Was this topic helpful?