Duty cycle of output channel
When working with the session-based interface, use the DutyCycle
property
to specify the fraction of time that the generated pulse is in active
state.
Duty cycle is the ratio between the duration of the pulse and the pulse period. For example, if a pulse duration is 1 microsecond and the pulse period is 4 microseconds, the duty cycle is 0.25. In a square wave, the time the signal is high is equal to the time the signal is low.
For function generation channels using Digilent devices, each waveform adopts the duty cycle
Create a session object and add a 'PulseGeneration'
counter
output channel:
s = daq.createSession('ni'); ch = addCounterOutputChannel(s,'cDAQ1Mod5', 'ctr0', 'PulseGeneration')
ch = Data acquisition counter output pulse generation channel 'ctr0' on device 'cDAQ1Mod5': IdleState: Low InitialDelay: 2.5e-08 Frequency: 100 DutyCycle: 0.5 Terminal: 'PFI0' Name: '' ID: 'ctr0' Device: [1x1 daq.ni.CompactDAQModule] MeasurementType: 'PulseGeneration'
Change the DutyCycle
to 0.25
and
display the channel:
ch.DutyCycle
ch = Data acquisition counter output pulse generation channel 'ctr0' on device 'cDAQ1Mod5': IdleState: Low InitialDelay: 2.5e-08 Frequency: 100 DutyCycle: 0.25 Terminal: 'PFI0' Name: '' ID: 'ctr0' Device: [1x1 daq.ni.CompactDAQModule] MeasurementType: 'PulseGeneration'
You can change the channel duty cycle while the session is running when using counter output channels.