A quick way to show a result or to display a data is represented by the connection of a digit display directly to the port of a microcontroller. Such device can be very quickly and easily connected to any picmicro provided by a couple of ports. In our case we'll use an 'old' pic16F84 or a newer pic16F628.
As we can see the four digits are connected to the same port (PORTB) and are switched on/off by the first four pins of the PORTA. Switching on, quickly, only one display at the time we can see the correct result according to the permanence of an image on the retina of the eye.
![]() |
Transistors: Any small NPN
Resistor: 2.2K to 10K on the base of the transistor; 330ohm between the port pins and the display.
int x,y,l; char numbers[16]={0x3F, 0x06, 0x5B, // Chars 0-9 A-F array void main() // --------------------Second loop same loop faster for (x=0;x<4;x++) //--------------------Third loop same loop very fast repeated 255 times for(l=0;l<255;l++) |
This is simple program (Mikroc) useful to check the integrity of the connections between the picmicro and the four led displays. The first array is used to store the characters (0-9 A-F) while a second array is used to set properly the PORTA (to switch on a single digit). A loop is repeated at different speeds three times where we can see (at higher speed) that all four display look switched on at the same time. The loop, in fact, must be repeated 256 times to be readable. Schematic to download available in the repository
|