03-12-2024 05:22 AM
Hello everyone. I am using a PCIe-6321 with .Net in visual studio.
I am trying to use counters to measure the pulse width of an incoming 200 kBit Signal wired to the ctr0 source pin (also tried ctr0 gate pin).
I followed the provided example for continous reading of the pulseWidth, but when i try to run my program I get the status code: -201314 "Multiple Sample Clock pulses were detected within one period of the input signal".
The following code was used to set up the counter:
myTask.CIChannels.CreatePulseWidthChannel("Dev1/ctr0","",0.0001,6000, CIPulseWidthStartingEdge.Rising, CLPulseWidthUnits.Seconds);
myTask.Timing.ConfigureSampleClock("/Dev1/PFI8",100000,SampleClockActiveEdge.Rising,SampleQuantityMode.ContinuousSamples,500000);
myTask.Control(TaskAction.Verify);
When I use implicit timing I don't get the error, but all the samples are 0. Also tested lowering the sample clock frequency, to the same error code as above.
The thing is, when I use the NI MAX software and create a pulseWidthTask in there with the same parameters I get the desired data.
I'm not quite sure if it's a problem with the wiring or the code. Sadly I can't copy/paste the rest of it as the PC used to program the 6321 is not connected to the internet.
Any help would be greatly appreciated.