08-26-2019 07:00 AM - edited 08-26-2019 07:02 AM
Hi all,
I am trying to get a NI 6210 to generate a waveform as shown in the attached picture, however, with the slight modification that the idle phases marked with red should be "low" and not "high". It is running on Win10, daqmx 19.1 and visual studio 2019.
The high frequency waveform is around 20-30kHz with a dutycycle ~25-85%, which should be output during the "high"period of the "low" frequency clock. The low frequency is ~100-600Hz with a duty cycle ~20-80%.
Currently I use a timer (ctr0) to generate the high frequency clock, setup with a digital pause trigger (PFI0) which is externally connected to the ctr1 counter output. This setup allows me to control the frequencies and duty cycles as intended, however the idlestate function is not doing as I would like. Right now it toggles between high and low values as seen in the picture, and I need it to be low during "the high frequency off period".
I have looked at the different examples from the daqmx drivers and from these I have setup the following code for setup I hope this is sufficient to see whats going on 🙂 :
<code start>
myTask = new Task();
myTaskOne = new Task();
//25kHz timer
//idleState = COPulseIdleState.Low;
myTask.COChannels.CreatePulseChannelFrequency(counterComboBox.Text,
"PulseGenPauseTrigger", COPulseFrequencyUnits.Hertz, idleState, 0.0,
Convert.ToDouble(frequencyTextBox.Text),
Convert.ToDouble(dutyCycleTextBox.Text)/100);
// Duty cycle timer
myTaskOne.COChannels.CreatePulseChannelFrequency(counterComboBox1.Text,
"PulseGenPauseTrigger", COPulseFrequencyUnits.Hertz, idleState, 0.0/,
1 / ((Convert.ToDouble(TRPL_TPH.Text) + Convert.ToDouble(TRPL_TPL.Text)) * 0.000001),
(Convert.ToDouble(TRPL_TPL.Text) / (Convert.ToDouble(TRPL_TPH.Text) + Convert.ToDouble(TRPL_TPL.Text))));
mytriggeredge = DigitalEdgeStartTriggerEdge.Rising;
myTask.Triggers.PauseTrigger.ConfigureDigitalLevelTrigger(pauseTrigSourceTextBox.Text, pauseCondition);
myTask.Timing.ConfigureImplicit(SampleQuantityMode.ContinuousSamples, 1000);
myTaskOne.Timing.ConfigureImplicit(SampleQuantityMode.ContinuousSamples, 1000);
mytriggeredge = DigitalEdgeStartTriggerEdge.Rising;
myTask.Start();
myTaskOne.Start();
<code end>
There might be an easier method of creating such pulses, and all help is very Welcome. I expect it should be possible to do internal routing of the counter triggering, however I dont know how 🙂
Thanks
/Tommy