With use 4 mecanic rotary encoder with this code (pic18f4550) ?
With use 4 mecanic rotary encoder with this code (pic18f4550) ?
A question, please? With the following "while" statement, does the program wait there until both encoder pins are high? If so, then you're only detecting one of every four AB transitions when moving continually in one direction, correct?
Code:while (portb.0=0 or portb.1=0):pause 10:wend![]()
Last edited by Mike, K8LH; - 16th August 2011 at 02:55.
Yes I think you are correct, this will only detect from 3 to 0 or 3 to 2. So it does not count in quadrature mode. It could be modified with a few more while loops to detect when it leaves the current state.
-Bert
The glass is not half full or half empty, Its twice as big as needed for the job!
http://foamcasualty.com/ - Warbird R/C scratch building with foam!
I think not since there is OR in the WHILE statement.
Ioannis
Yup, as long as one is LOW, it remains in the loop.
Robert
Bookmarks