The data pins (a-g) of all the seven-segments are connected to a single port (Port D*) as shown in the circuit diagram. Transistors BC547 are connected to COM pins of seven-segment for switching. The switching of COM pins is controlled by four pins of PortA.
*Please note that the pins of PortD are not continuous and care has to be taken while making the connection.
The multiplexing concept is based on the principle of persistence of human vision. A human eye cannot detect a visual change if the frames change at a rate of 25 (or more) frames per sec. This means that if events occur continuously with a time difference of less than or equal to 0.04 sec (1/25 sec), then we cannot notice the transition between those events.
Considering this, the seven-segments are switched on one by one with a very small time delay. Thus, even though only one segment glows at a time, it appears that all the segments are glowing together. (See video) Thus the key factor in multiplexing is switching time of the segments.
· The count value to be displayed is stored in a variable.
· Extract the individual digits from the count value into different variables.
· Turn on the seven-segments one by one with a small time delay.
· Send the hexadecimal values corresponding to individual digits to PortD.