06-14-2022 03:05 AM
Hello,
I have a NI DAQmx USB 6343mx
I have 6 motors who need a PWM signal with different speed. Motor 1 and 2 speed1, motor 3 and 4 speed 2 and motor 5 and 6 speed 3. And i have to start the combinaties differently.
I use 3 Tasks with a COChannel with a CreatePulseChannelFrequency to create 3 PWM signals using ctr0, ctr1 and ctr2.
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 ctr0 (PFI12, pin 89), ctr1 (PFI13, pin 91) and on ctr2 (PFI14, pin 93).
Then i want to connect the 3 PFI terminals with ConnectTerminals to some other PFI terminals because i have 6 motors.
ctr0 (PFI12) -> PFI1 and PFI2 (motor 1 and 2)
ctr1 (PFI13) -> PFI3 and PFI4 (motor 3 and 4)
ctr2 (PFI14) -> PFI5 and PFI6 (motor 5 and 6) so i can set the frequency differently and start them differently
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
Also tried all kind of cominations but it looks like that ConnectTerminals only works on 2 CTR channels at the same time.
I cant find anything about restrictions in the documentation.
Any help would be kind.
My code below.
task1 = new Task("");
task2 = new Task("");
task3 = new Task("");
task1.COChannels.CreatePulseChannelFrequency($"/Dev1/ctr0", "", COPulseFrequencyUnits.Hertz, COPulseIdleState.Low, 0, 1000, 50 / 100.0);
dtask2.COChannels.CreatePulseChannelFrequency($"/Dev1/ctr1", "", COPulseFrequencyUnits.Hertz, COPulseIdleState.Low, 0, 500, 50 / 100.0);
task3.COChannels.CreatePulseChannelFrequency($"/Dev1/ctr2", "", COPulseFrequencyUnits.Hertz, COPulseIdleState.Low, 0, 250, 50 / 100.0);
task1.Timing.ConfigureImplicit(NationalInstruments.DAQmx.SampleQuantityMode.ContinuousSamples, 1000);
task2.Timing.ConfigureImplicit(NationalInstruments.DAQmx.SampleQuantityMode.ContinuousSamples, 1000);
task3.Timing.ConfigureImplicit(NationalInstruments.DAQmx.SampleQuantityMode.ContinuousSamples, 1000);
Task1.Start();
Task2.Start();
Task3.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");
Regards,
Herbert Veldhuis