|
Now if you open up the source code you will notice that this program will simply count from '0' to '9' and then repeat again in an infinite loop. Also notice that in order to display each number, we need to send a certain combination of 8-bits to PORTB.|
So having said all that - do you know why a logic zero will turn on an LED? Well the answer is simple. Remember that the seven segment displays are common anode - all the anodes are connected to +5v already, so in order to turn an LED on, we need to connect the cathode to ground (through a resistor) what logic is equal to ground? LOGIC ZERO OF COURSE!
Some things to experiment with in this sourcecode
Try and count through all the hexadecimal digits I.E 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E and F.
What combination of 1's and 0's do you need to make the extra digits? |
|