Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

create multiple counter channels

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?

 

 

0 Kudos
Message 1 of 3
(1,096 Views)

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

 

Santhosh
Soliton Technologies

New to the forum? Please read community guidelines and how to ask smart questions

Only two ways to appreciate someone who spent their free time to reply/answer your question - give them Kudos or mark their reply as the answer/solution.

Finding it hard to source NI hardware? Try NI Trading Post
0 Kudos
Message 2 of 3
(1,079 Views)

Thanks, Santo_13

0 Kudos
Message 3 of 3
(1,058 Views)