Regarding the image below. I don't understand the purpose of the diodes on the switches. (Ignoring RB4, that's a special case.)
The way the display works is that each digit is enabled, in turn. Digit 1 is connected to switch 1, digit 2 to switch 2, etc. As a digit is enabled, the switch connected to that pin can be tested for being closed. Clever.
RB4 - RB7 are set as outputs, never input. The pin is set high to enable that digit and set low when any other digit is enabled. The pin that reads the switches, RA3, only acts as an input (by design that's all it can do).
But I don't see the purpose of the diodes. I've tested this without the diode on, say, RB5/switch2, and it doesn't appear to be any different. The only thing I can think of is that maybe the diode helps the switching function?
EDIT: I cleaned up the image to be more concise, for the question.
The way the display works is that each digit is enabled, in turn. Digit 1 is connected to switch 1, digit 2 to switch 2, etc. As a digit is enabled, the switch connected to that pin can be tested for being closed. Clever.
RB4 - RB7 are set as outputs, never input. The pin is set high to enable that digit and set low when any other digit is enabled. The pin that reads the switches, RA3, only acts as an input (by design that's all it can do).
But I don't see the purpose of the diodes. I've tested this without the diode on, say, RB5/switch2, and it doesn't appear to be any different. The only thing I can think of is that maybe the diode helps the switching function?
EDIT: I cleaned up the image to be more concise, for the question.
Last edited: