Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Taking a single measurement per encoder position

Hi, I'm using a Usb 6353 to take a range of digital and analogue measurements based around a revolving shaft. I have a quaadrature encoder in X4 mode on the DAQ to measure angular position and I wish to take an analogue measurement for each encoder count.

](At the moment I capture data at high freuency and post proccess by removing most of it to get the data I want - as I can only know my relative shaft position based on the resolution of the encoder most of the recorded data is usless.)

 

I believe that the correct method is to use the counter on the encoder as the clock pulse source but I can't firgure out how to do so.

 

My vi is based off of the work here:
https://decibel.ni.com/content/docs/DOC-10785

0 Kudos
Message 1 of 6
(4,700 Views)

Hi Joe,

 

Are you able to look at the counter output from the encoder to ensure it's working as expected ? You could set up a Analogue input task in MAX and look at what happens when the shaft turns. 

 

Could you give me a more descrtiption on what happens when you run your code at the moment ? 

Kind Regards,
Lucas
Applications Engineer
National Instruments
0 Kudos
Message 2 of 6
(4,664 Views)

Thanks for the help Lucas,
if I run the code that I have it will sample at a fixed rate - I get the encoder readings and analogue readings fine but I have multiple copies of the same data as the acquisition rate is so high. This is what I want to avoid as these logs run for quite some time and the file size is getting large.

If I use one of the PFIO inputs from one of the encoder lines the code works as I want it to but the frequency is a quarter of what it needs to be so I dont get a measurement per encoder counter increace and miss out on too much data.

 


Essentialy what I want to plot is encoder position Vs. analogue measurement.


Regards,
Joe

0 Kudos
Message 3 of 6
(4,662 Views)

Hi Joe,

 

Okay I understand, I was wondering if another implementatino would be to use shift registers to check current  and last encoder position and discard it if it's the same. This would achieve the same effect, but not as clean ? 

 

 

Kind Regards,
Lucas
Applications Engineer
National Instruments
0 Kudos
Message 4 of 6
(4,639 Views)

You can use the encoder signal directly as a sample clock for your analog task which would allow you to sample on the rising (or falling) edge of one of the encoder signals.

 

If you want to sample on all four transitions (rising edge of A, rising edge of B, falling edge of A, falling edge of B) you would need to connect the encoder signals to port 0 and configure a digital input task with change detection timing (configured to sample on rising and falling edges of the two inputs).  Then you would use the "change detection event" as the sample clock for your analog task.

 

Since encoder signals are usually pretty noisy, you will likely want to configure a digital filter on the A and B inputs being used for the sample clock--noise on the clock line would result in samples being taken too quickly and possibly an ADC overrun error.

 

 

Best Regards,

John Passiak
Message 5 of 6
(4,628 Views)

Sorry for the slow reply as I was on holiday,

Thanks John that sounds exactly what I want. I've had a look at the outputs of the encoder and I think that in this instance they appear to be clean enough that I should be able to use them without filtyering( I hope!)

 

Regards,

Joe

0 Kudos
Message 6 of 6
(4,512 Views)