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
Quadrature Encoder (mouse)
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: Quadrature Encoder (mouse)
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.
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.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Posts: 157
- Joined: Sat Jan 22, 2011 10:39 pm
- Location: Michigan
- Has thanked: 6 times
- Been thanked: 27 times
- Contact:
Re: Quadrature Encoder (mouse)
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
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