Page 1 of 1

Quadrature Encoder (mouse)

Posted: Mon Jan 31, 2011 3:03 pm
by Bobw
I am planning on using an encoder from a mouse for a project I am working on. I have Flowcode PIC4 on order.
I know there is not a component for this in Flowcode, (hope they add one). The final project will be on a PIC16F1827, but I am using a PIC16F88 to play with for now.
Does anyone have a "C" sample of how to read the encoder for UP/DOWN Count (left or right)?
I plan on using RA2 and RA3 on the 16F88.
For a start all I want to do is Increment or decrement the count and display it on an LCD. I can handle the display part and the math (Up/Down), but I am totally lost on how to read the encoder. I am still trying to learn C so it does not take much to go right over my head.

Bob

Re: Quadrature Encoder (mouse)

Posted: Mon Jan 31, 2011 3:06 pm
by Benj
Hello Bob,

This forum topic may be of some use for you.

http://www.matrixmultimedia.com/mmforum ... oder#p7809

It uses a quaderature peripheral onboard the chip to monitor the input.

If you are using a chip that does not have this peripheral eg the 16F88 then you will need a port change interrupt enabled for both the signals from the encoder to allow you to detect the signal transitions as they occur.

Re: Quadrature Encoder (mouse)

Posted: Mon Jan 31, 2011 4:15 pm
by Bobw
Ben;

And I thought getting the LCD to display "Hello World" was hard.
I have read most of the post on here with regards to Encoders. Wish I could use an ACD input due to I understand it and simpler to implement, but it is not absolute enough for rotation. Without a way to simulate in Flowcode, Will have to use a Code/Program and try it mode I guess. I have not yet come up with a final PIC to use with this project, so the 16F88 has been great to learn with.

Bob