LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Data acquisition driven by encoder

Hi everyone,

 

   I need to sample a capacitive sensor that measures the radial run-out (radial small displacement) of a rotating spindle. LabView v. 7.1 is employed to acquire the data by means of PCI-6036E card commercialized by National Instruments (NI). The spindle rotates at 100 rpm and a rotary incremental encoder is fixed at rear of spindle. The encoder gives two types of digital pulses as follows: a) A-quad-B pulses (it will be used only “A” pulses in this experiment); b) index pulse (one pulse per revolution). This encoder provides 1024 pulses type “A” per revolution. The measurements made by the sensor are driven by “A” pulses which are used as “external clock”. Therefore, every “A“ pulse, the card acquires one sample from sensor. Thus, 1024 data/rev are acquired. I want to sample 5 consecutive revolutions of the spindle. To start the data acquisition, the index pulse of the encoder is used as “start digital trigger”. Also, the index pulse should be used to count the number of revolutions of the spindle. In this way, when the number of revolutions is equal to 5, the data acquisition finishes. By contrast, the programmer also can set the number of samples equal to 5x1024 in the VI. The data acquisition is finished when the number of samples reaches this value. Similarly, the sampling process is started by the index pulse which is the “start trigger”. Note: 1) the sampled data should be put in a buffer. After the sampling process is finished, this data should be saved in a file of LabView; 2) In fact, the data acquired by the sensor are voltage analog input. Questions:1) Could you make a VI for this problem, please? Note: You can use the DAQ ASSISTANT EXPRESS VI or DAQmx TASK NAME CONTROL method.2) How to program the LabView in order to sample data triggered by the rotary encoder (pulse “A”)?3) What should I do to stop the data acquisition at the end of 5 revolutions?4) Could you send examples (VIs) similar to my problem above?5) How can I know if the program (VI) looses an “A” pulse? Is there any kind of error in VI that indicates a miss pulse?  In anticipation, thank you very much for any help. My e-mail: bruceam801@hotmail.com                                                                                      Bruce
0 Kudos
Message 1 of 2
(2,828 Views)

Hello Bruce,

 

I have a complete solution for this but I cannot give you the VIs because my customer has paied for it and all rights are transfered to him.

 

What you need are two tasks.  One task is the analog in task. You must use the DAQmx Timing.vi and the DAQmx Trigger.vi to set it up as needed. Or you create a task in MAX with this setup. The other task is a counter task just counting the pulses from the z-Index.

 

Next you need a small state machine with the states:

init, start, wait and stop.

init will initialize and start the tasks

start will read out the z pulse counter and wait for a change from 0 to 1

wait will read out the z pulse counter or the available samples property, when the desired number of z pulses or samples are available read the buffer with DAQmx Read.vi

stop will stop both tasks and clear them.

 

 You will need two additonal counters which you don't have to check for lost A pulses and a external flip-flop electronic. The flip-flop will change it's state with each z pulse and the output will be used for gated counting. With each change of the z pulse counter you need to read out one of the additional counters to check if he had seen the correct number of pulses.

Waldemar

Using 7.1.1, 8.5.1, 8.6.1, 2009 on XP and RT
Don't forget to give Kudos to good answers and/or questions
0 Kudos
Message 2 of 2
(2,804 Views)