Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

ConnectTerminals problem

Hello,

 

I have a NI DAQmx USB 6343mx

 

I use 3 counters with a CreatePulseChannelFrequency to create 3 PWM signals using ctr0, ctr1 and ctr2.  I create them in 1 Task, did it also in 3 different Task with the same result.

Counter 1 runs on 1000 HZ, counter 2 on 500 Hz and counter 3 on 250 HZ.

Works perfectly. With a logic analyzer i see the outputs on PFI12 (pin 89), PFI13 (pin 91) and on PFI14 (pin 93).

 

Then i want to connect the 3 PFI terminals to some other PFI terminals.

 

What i see is that the ConnectTerminals method works for PFI12 (ctr0) and for PFI14 (ctr2) but never for PFI13 (ctr1), i really dont know anymore what to do. I dont get errors just the PWM signal on PFI13 doesnt appear on the connected terminals PFI2 and PFI3

Any help would be kind.

 

My code below.

 

 

task = new Task("");
task.COChannels.CreatePulseChannelFrequency($"/Dev1/ctr0", "", COPulseFrequencyUnits.Hertz, COPulseIdleState.Low, 0, 1000, 50 / 100.0);
dtask.COChannels.CreatePulseChannelFrequency($"/Dev1/ctr1", "", COPulseFrequencyUnits.Hertz, COPulseIdleState.Low, 0, 500, 50 / 100.0);
task.COChannels.CreatePulseChannelFrequency($"/Dev1/ctr2", "", COPulseFrequencyUnits.Hertz, COPulseIdleState.Low, 0, 250, 50 / 100.0);
task.Timing.ReferenceClockSource = "OnboardClock";
task.Timing.ConfigureSampleClock("OnboardClock", 1000, SampleClockActiveEdge.Rising, SampleQuantityMode.ContinuousSamples);
task.Timing.ConfigureImplicit(NationalInstruments.DAQmx.SampleQuantityMode.ContinuousSamples, 1000);
digpwm1.Start();

 

DaqSystem.Local.ConnectTerminals($"/Dev1/pfi12", $"/Dev1/pfi0");
DaqSystem.Local.ConnectTerminals($"/Dev1/pfi12", $"/Dev1/pfi1");

DaqSystem.Local.ConnectTerminals($"/Dev1/pfi13", $"/Dev1/pfi2");
DaqSystem.Local.ConnectTerminals($"/Dev1/pfi13", $"/Dev1/pfi3");

DaqSystem.Local.ConnectTerminals($"/Dev1/pfi14", $"/Dev1/pfi4");
DaqSystem.Local.ConnectTerminals($"/Dev1/pfi14", $"/Dev1/pfi5");

 

VeH_0-1616066403804.png

 

 

Regards,

 Herbert Veldhuis

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

Hi Herbert,

 

Can I ask what you're trying to do when you're doing this terminal connection? It looks like we're using the default output channels of the USB-DAQ counter tasks and then trying to connect additional terminals to the default terminal. 

You should look at the PulseTerminal property that you can assign to your Counter Output task instead, which will let you explicitly state the terminals you want to generate your pulses on. This would let you directly route your counter output to the PFI lines you want.

 

I don't have a USBDAQ with me currently to verify, but I simulated a 6343 and it states that Ctr1 is used for the routing of signals between PFI lines in the Device Routes in NI MAX. I expect this is why you aren't seeing an output, as you have a resource being used for multiple things. What happens if you try to use "Verify" from Control Task to route the lines? Do you see an exception thrown at this point?

 

Cheers,

Nick

 

Message 2 of 3
(1,872 Views)

Hello, thanks for your help.

 

The situation is:

1.  I have 6 stepper motors, motor 1 and 2 should run at a speed 1, motor 3 and 4 should run at speed 2 and motor 5 and 6 should run a speed 3.

2.  I have 6 stepper motor drivers and they need a pwm signal to drive the stepper motor they are connected to.

3. So i thought i make a pwm signal using CreatePulseChannelFrequency on ctr0 (pfi12, speed1) and connect it to pfi0 for motor 1 and 2.

then another pwm signal on ctr1 (pfi13, speed 2) and connect it to pfi1 for motor 3 and 4 and

another pwm signal on ctr2 (pfi14, speed 3) and connect it to pfi3 for motor 5 and 6.

 

So i thought i have 6 terminals to connect to the 6 drivers i use for the stepper motors. I dont want to connect more than 1 driver to a terminal pin.

 

This is what i want to achieve, and maybe in the future even a few pumps more.

 

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