04-02-2014 03:08 AM
Hi,
This may seem like an absurdly simple question so please forgive me.
I would like to record a counter value and the state of a digital input pin at the same time.
I have two tasks ( because apparently one cannot have two different channels in the same task)
counter_read_task.CIChannels.CreateLinearEncoderChannel("/" + device_name + "/ctr0", "ctr", CIEncoderDecodingType.X4, false, 0.0F, CIEncoderZIndexPhase.AHighBHigh, 1.0F, 0.0F, CILinearEncoderUnits.Ticks);
dig_in_read_task.DIChannels.CreateChannel("/" + device_name + "/PFI2", "DI-1", ChannelLineGrouping.OneChannelForEachLine);
I then allocate timing resources to those tasks :
counter_read_task.Timing.ConfigureSampleClock("/" + device_name + "/PFI3", 10000f, SampleClockActiveEdge.Rising, SampleQuantityMode.ContinuousSamples, 1000);
dig_in_read_task.Timing.ConfigureSampleClock ("/" + device_name + "/PFI3", 10000f, SampleClockActiveEdge.Rising, SampleQuantityMode.ContinuousSamples, 1000);
But I get an exception that essentially says this :
04-03-2014 12:22 PM
Hi Tom,
Yes you can have more than one channel in the same task but they need to be different task types.
counter_read_task.Timing.ConfigureSampleClock
This is where I think you are running into an error. The USB-6210 does not support hardware timing. Therefore this module only support software timing. That being said, you need to select the sample timing type on demand in order for it to be software timing.
Warm Regards,
William Fernandez
Applications Engineering
National Instruments