Sign in to follow this  

Quadrature encoders and LCD


ivanjh
  • A "simple" quadrature interface for the ZPU, using the standard HD44780 code in the ZPUino IDE install, a sketch to read the quad counter and write to the LCD.

Hmm, this is something I started myself a while ago.

One of the problems with extending the AVR softcore is that it just didn't seem to be built for a peripheral rich setup (IO space, etc). But I didn't want to leave an open source GCC based solution. Which is why I've watched the ZPU work with interest.

I recently tried to use a quadrature interface from opencores, but it was far too featureful and resource heavy.

So instead, I created my own "simple" quadrature interface for the ZPU, and using the standard HD44780 code in the ZPUino IDE install, created a sketch to read the quad counter and write to the LCD.

It is so very nice to read a quadrature encoder as simply as:

unsigned int y=REGISTER ( IO_SLOT (8) ,0);
Serial.println(y);

And to know that it is being clocked at 96Mhz. :)

(Of course, I most probably have created a piece of junk, full of bugs - but I think it's cute)

The code's a complete mess, but if you're interested... it's attached.

View attachment: ZpuQuadDec.zip


Download Source Code
Source Code Link

  • Like 3
  Report Article
Sign in to follow this  


User Feedback


There are no comments to display.



Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now