IMPLEMENTED SO FAR

- Support for 4x20 LCD Display and large number display
- Brightness and contrast adjustment with remote
- (OPUS/Wolfson WM8741) DAC volume control: remote and rotary encoder
- (OPUS/Wolfson WM8741) DAC random filter selection 1 to 5 with remote
- (OPUS/Wolfson WM8741) DAC upsampling selection (L, M, H -this is the OSR setting)
- I2C level shifting (5V to 3.3V)
- Optimized power-up sequence

Saturday, March 21, 2009

How to Read Rotary Encoder (I)

Connect the Channel A pin and the Channel B pin of a rotary encoder into two Arduino inputs. Then there are several ways to read the encoder:
  1. Polling for the value of the pins: write a loop that reads the value of channel A and channel B and compare with previous value. NOT APPEALING. The processor is in an infinite loop.
  2. Have channel A interrupt on the falling edge and read the value of channel B. MORE APPEALING. The processor only works when it needs to. (Note: Arduino can handle two external interrupts and can be set as interrupting on a falling edge). Disadvantage: there is a falling edge every two clicks. This solution works at half the resolution of the encoder.
  3. Have channel A and B interrupt and read the value of the other channel. MORE APPEALING. With two interrupts, you can read the encoder at full resolution. Disadvantage: since Arduino can only handle two external interrupts, you can only attach a single encoder to the board.
This is explained in much greater detailed in the Arduino Playground


No comments: