Quantcast
Channel: CNCzone.com- Largest Forums for CNC Professional and Hobbyist alike!
Viewing all articles
Browse latest Browse all 72868

Solved Reading quadrature glass slide with Arduino

$
0
0
It turns out that reading a quadrature glass slide with an Arduino isn't easy. I've scoured the Net and these forums for code. I've implemented interrupts, I've read ports in the loop(), which is pretty fast when that's all you're doing! But no matter what, it was pretty easy for the Arduino to skip ticks from the glass slide -- even when only looking at A rising (or falling), so it was 1/4 of the possible resolution from 1 micron scale.

Then someone here mentioned using D flip flops and something clicked from that education I got last century...

I hooked up D1 and by coincidence, noticed pulses were coming out only in one direction! This is what I was hoping for... put the logic here, so the Arduino only interrupts to increment (on D2) or decrement (D3), which is the direction of my particular slide's orientation.

I'm still able to make it skip counts, so I ordered a HCTL-2001-A0 from Amazon that should be here Friday. In theory, it will store position! Then I'll have the Arduino simply read it every 1/4 second and update its readout.

I'll keep this updated and post code and all that as I learn more.

:) Chris
Attached Images

Viewing all articles
Browse latest Browse all 72868

Trending Articles



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