03-28-2024 05:40 AM
Hi, I currently have an acquisition problem with an external clock reference.
Equipment used :
I want to acquire a voltage mesurement for each motor step. The motors makes a movement of 26 665 step.
I start my acquisition with a trigger on the same signal of the external clock.
Problem :
I think it's probably a signal clock problem but the signal looks good.
If you have an idea, i'll take it.
I'm sorry for my bad english.
Thanks
Exemple configuration Code :
//Create a new task
myTaskAcquisitionVoie4 = new NationalInstruments.DAQmx.Task();
//Create a virtual channel
myTaskAcquisitionVoie4.AIChannels.CreateVoltageChannel(channel, "",(AITerminalConfiguration)(-1), Convert.ToDouble(0),Convert.ToDouble(10), AIVoltageUnits.Volts);
myTaskAcquisitionVoie4.Triggers.StartTrigger.ConfigureDigitalEdgeTrigger("/Voie4/PFI" + PFI, DigitalEdgeStartTriggerEdge.Rising);
//EXTERNAL CLOCK SOURCE
myTaskAcquisitionVoie4.Timing.ConfigureSampleClock("/Voie4/PFI" + PFI, 810,SampleClockActiveEdge.Rising, SampleQuantityMode.FiniteSamples,26665);
myTaskAcquisitionVoie4.Stream.Timeout = -1;
// Verify the Task
myTaskAcquisitionVoie4.Control(TaskAction.Verify);
//Instanciation des objets NI
analogInReaderAcquisitionVoie4 = new AnalogMultiChannelReader(myTaskAcquisitionVoie4.Stream);
analogCallbackAcquisitionVoie4 = new AsyncCallback(AnalogInCallback_AcquisitionVoie4);
// Use SynchronizeCallbacks to specify that the object
// marshals callbacks across threads appropriately.
analogInReaderAcquisitionVoie4.SynchronizeCallbacks = true;
//On lance l'acquisition
analogInReaderAcquisitionVoie4.BeginReadWaveform(26665, analogCallbackAcquisitionVoie4, myTaskAcquisitionVoie4);
03-28-2024 06:59 AM - edited 03-28-2024 07:00 AM
I would agree that it seems to be an issue with the clock signal, despite the fact that your scope trace looks clean. I've been in similar situations where behavior implied a glitchy signal but scope traces showed nothing unusual. I'm not an EE myself, and this is where I'd try to find one to help with the diagnosis.
That said, I would also try tinkering with setting up a digital filter on the clock signal. M-series devices have *some* support for digital filtering on PFI lines, but I don't know for sure if you can set it up on your specific device under your specific usage (PFI used as sample clock for AI task).
There's another way to accomplish something fairly similar though using one of your device's counters. Here's an outline:
Here's how/why it works. Once triggered by a real step pulse, the counter needs to get all the way through its pulse generation before re-arming to be ready for the next trigger. Thus, any glitches that occur before the pulse is complete will be effectively ignored. The counter's output will only be delayed by ~1 microsec from the step pulse, which will likely be negligible for your purposes.
Even *if* there's a glitch just before a legit step pulse that your counter triggers off of, you'll just generate your output pulse slightly early, ignore the legitimate step pulse this time, but be ready to catch the next real one. So instead of getting lots of extra AI samples, you only have a small risk of an occasional slight difference in the interval times between samples.
-Kevin P
04-04-2024 03:35 AM
Hello Kevin_Price, thank you for your reply.
I did'nt find an option to activate a digital filter intergrated into the NI card and I didn't do it myself.
I analysed the signal more closely and it is really correct (as good as from GBF and the GBF signal don't work too).
I don't understand what more it needs.
Having a free input on my analog inputs, I decided to simultaneously acquire this clock signal (motor impulsion) and other signals with the internal clock of the card with an higher frequency.
I do signal processing after acquisition (schmitt trigger type) in order to detect each rising edge ans associate my data with it. I think this is the simplest method at the moment.
Thanks again.
Adrien
I did not find an option to activate a digital filter integrated into the NI card. I didn't bother to do it myself either.
Having a free input on my analog inputs, I decided to simultaneously acquire this clock signal (not motor) and my other signals with the internal clock of the card with a much higher frequency. I then carry out signal processing (Schmitt trigger type) in order to detect each rising edge and associate my data with it. I think this is the simplest method at the moment.
Thanks again.
Adrien