12 DIGIT RUNNING SIGN using PIC16F628
It’s 1970 and a 12 digit LED Display for pocket calculators has just been released.
Nation Semiconductors are in the forefront of designing miniature displays for calculators and have a range from 2-digit to 16-digit displays.
The actual 7-segment displays are so small it takes a bubble magnifier in front of the LEDs to see the digits. We have used one of these in this project.
Fast forward to 2011. These displays are now obsolete and we can find them in surplus stores for a few dollars.
In this project we use one to produce a LED display. It has two features. The characters can be static or “running” and the display can be seen at night.
HOW THE CIRCUIT WORKS
The circuit consists of a number of “Building Blocks.”
The main blocks are the LED display, the micro, the 4017 IC and the 5-buttons.
The display is scanned (multiplexed) but not in the normal way.
Normally the segments are accessed and the common cathode for the first display is turned on to produce a run-of-12 and each display would get 8% of the total time.
In other words the digits are illuminated from left-to-right and this is done quickly so that they all appear to be lit at the same time.
But we can improve on this by a factor of 50% by connecting all segment A’s together, all B segments together etc and take all the cathodes to 0v rail via separate lines. In this way we can access the segments via a run-of-eight and provide 12% illumination for each segment. This will result in a brighter display.
This is how the display is configured internally and how the display is intended to be accessed.
In this method of driving the display, only one segment of each digit is turned on at any time and this means the “common” only requires about 25mA “sinking capability.” This requirement can be handled via the micro, while the emitter-follower from the 4017 drives all 12 segments (such as segment “A”) at the same time.
We supply 25mA (actually sink 25mA) via the micro but when this is divided by a run-of-eight, the average current is only 3mA to each segment. However this is sufficient to produce a bright display.
The 4017 must be synchronised with the data being delivered to the display from the micro, otherwise the wrong segments will be illuminated and the correct image will not appear.
Synchronisation is done by monitoring “output 8” – the 9th output of the 4017 IC and when it is high, we can clock the 4017 to the first output, ready for the start of the scanning routine.
The 4017 is a “shifting chip” in which one output of the 10 is HIGH at a time. We use this to access the 8 segments and the 9th output is taken to the micro to produce co-ordination between the two chips.
The 5 keys on a single input/output line is polled for activity by calling the Sw sub-routine and if a button is pressed, the program goes to the sub-routine associated with the button.
To find which key has been pressed, a 100n capacitor is charged via output RA6 of the micro. The line is then turned into an input and polled to see if the capacitor discharges. If one of the buttons is pressed it will get discharged before a 20mS time-interval and the routine knows a button is pressed.
The capacitor is now charged again and the line is turned into an input and the time taken for the capacitor to discharge, via the button being pressed, is detected.
The resistor values have been chosen to produce different timings and the sub-routine detects the correct button.
The micro has two 8-bit ports. 4 lines from port A and 8 lines from port B have been used to take the common cathodes of each digit to 0v.
The micro will allow 25mA to flow though the common cathode of each digit and this is sufficient to produce a bright display via the multiplexing routine we have used.
All the rest of the features of this project are in the program.
The numbers and letters for the display are contained in a table and only a few of the letters are missing as they cannot be reproduced.
HOW THE PROGRAM WORKS
This program consists of sub-routines and these are placed in alphabetical order so they can be easily located when working on the program.
All the code was created and tested by creating one sub-routine at a time and if a problem develops, you can add a halt instruction to the program (goto $) and see how a particular part of the code operates.
The micro starts at location 000 and carries out the Start-Up routine.
It then goes to Main where it finds a number of instructions to call sub-routines. One of the sub-routines is the switch or button routine where it checks to see if a button has been pressed.
The most difficult code to generate was the timing for the 5 buttons.
We had to work out the timing (delay value) and resistor value for each button. We created a sub-routine where button 1 turned on segment A, button 2 turned on segment B etc. We then added a 100k pot and a separate button. By turning the pot, a particular segment was illuminated. You will find this sub-routine as “Sw” in the final program. We then found the resistance where one segment turned off and the next segment turned on. These became the limits for each segment (by measuring the resistance of the pot) and we chose a resistor mid-way between the two values.
A button can be pressed at any time and it is detected by charging a 100n capacitor while the button is pressed and measuring the time for the cap to discharge via a resistor connected to the button.
Each button has a different resistance and a loop of 2mS is executed. When a LOW is detected, a count-value is created and this corresponds to a button.
For more detail: 12 DIGIT RUNNING SIGN using PIC16F628
EasyEDA: Ideas for Circuit Design, Innovation for Electronics Access
Free Circuit Design: Schematic – Simulation – PCB Layout – Gerber Viewer
JLCPCB Prototype: Only $2 for 10pcs 10×10cm, 24 hours Quick Turn, DHL Delivery in 3 days
Current Project / Post can also be found using:
- Microcontroller with tetris game make
- which pic micro controller is best for 3×5 led matrix interfacing