Quantcast
Channel: Counter/Timer topics
Viewing all articles
Browse latest Browse all 1271

Bad Acquisition with external Clock (C# program)

$
0
0

Hi, I currently have an acquisition problem with an external clock reference.

 

Equipment used : 

  •  Acquisition Card : NI USB-6210.
  • External Clock is motor step (see attachment picture for the signal) (approximately 800 Hz)
  • Programming Language : C# (Visual Studio) (see attachment picture code)

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 : 

  • If i acquire with continuous sample and on rising edge of the clock, I acquire approximately 48 000 points and on falling edge i acquire approximately 27 300 points.
  • If i acquire with finite sample (26 665), I dont have the totaly of the movement.
  • I have to put a timeout to -1 otherwise I get errors during acquisition.

 

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);

 

 


Viewing all articles
Browse latest Browse all 1271

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>