
number of “clicks” of the rotary encoder, and the direction the knob was turned in, and at
the same time debounce the switch transitions.
Another unnecessary component often seen is a pullup-resistor on a switch signal to a
microcontroller, so that when the switch is open (not pressed) the microcontroller sees a
“high” voltage. This is unnecessary because modern microcontrollers such as the
ATmega328P all contain configurable internal pull-ups!
I had a little more trouble when it came to the “Select”, “Rotary” (shaft of the rotary encoder)
and “Exit” push-buttons. Despite thinking that the microcontroller had plenty of I/O signals
available, when I came to implement all the features I had in mind, I realized there weren’t
enough I/O signals to read the buttons!
The solution was to analogue-multiplex all three buttons onto a single input signal to the
microcontroller, which is one of the Analogue to Digital Converter (ADC) channels. No
microcontroller internal pull-up is used because I need to have precise control over the
voltage levels.
The circuit fragment above shows the rotary encoder, and the three buttons (two tactile
switch buttons, plus the button internal to the rotary encoder shaft) which are located on the
front panel PCB.
The input signal is pulled low by a 10K resistor R46. One side of all three buttons is
connected to the I/O pin. The other sides of the buttons are connected to 5V via different
resistors: 3.3K (R44) for the left (“Select”) button, 1K (R45) for the right (“Exit”) button, and
direct connection for the center (“Rotary”) button. When one of the buttons is pressed, the
resistors form a potential divider that sets the voltage to the microcontroller depending on
which button is pressed. Some calculation results in the following table of voltages
depending on which button is pressed:
Button pressed Voltage
None
0.00V
“Select”
3.76V
“Rotary”
5.00V
“Exit”
4.55V
QCX-mini assembly Rev 1.05
100
Содержание QCX-mini CW
Страница 15: ...QCX mini assembly Rev 1 05 15...
Страница 16: ...QCX mini assembly Rev 1 05 16...
Страница 17: ...QCX mini assembly Rev 1 05 17...
Страница 19: ...Main board Display board Controls board QCX mini assembly Rev 1 05 19...
Страница 24: ...QCX mini assembly Rev 1 05 24...
Страница 84: ...QCX mini assembly Rev 1 05 84...