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



User Feedback


There are no comments to display.



Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Add a comment...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.