11-08-2022 11:01 AM
I had a USB 6353 DAQ board, which has 4 counters. I want use these 4 counters to output 4 pulse trains at different frequncy, duty cycle with different delay.
I am using Microsoft visual Studio 2019 and tried NI's .Net example code. The example code uses only one single counter. When I tried to "create" another counter, it report error.
Here is my code,
coTask = new Task();
dioTask = new Task();
coTask.COChannels.CreatePulseChannelFrequency("Dev1/ctr1", "PulseTrain", COPulseFrequencyUnits.Hertz, COPulseIdleState.Low, 0.0, 1000, 0.5);
--------- the ctr1 counter is created without error
//The following line report error when create the second counter channel "Dec1/ctr0
coTask.COChannels.CreatePulseChannelFrequency("Dev1/ctr0", "PulseTrain",COPulseFrequencyUnits.Hertz, COPulseIdleState.High, 0.0, 100, 0.3);
------ it report, "Specified channel cann't be added to the task, because a channel with the same name is already in the task"
If I only use one single channel, Dev/ctr0 or Dev/ctr1, my code works. Where I did wrong? I need to create a task for each counter to use "createPulseChannelFrequency()" function? or there are other functions to use all counters?
11-08-2022 12:32 PM - edited 11-08-2022 12:34 PM
You'll have to create a separate task for each counter.
Depending on the type of pulse generation, more than one counter may be required for a task, please refer to this article - https://knowledge.ni.com/KnowledgeArticleDetails?id=kA00Z000000P7eESAS&l=en-US
11-08-2022 07:00 PM
Thanks, Santo_13