Controlling a seven segment display
In this project you will use your PIC to display numbers on a seven-segment display.
In this example, we will be using PIC 18F4520 to control a double digit 7-segment display LTD-4708JS. A few notes about using this display is that it is only designed to display one unit at a time, so when trying to use both digits, you have to use an ISR to switch between the two digits to create the illusion that both are on simultaneously.
Now, since there are 7 segments, one would assume that you would need 7 outputs from the PIC to display 1 digit. But it is very wasteful to use outputs from the PIC for just displaying like this, so we will be using a chip (HEF 4543B) that will take 4-bits and convert it to the 7-bit output for the 7-segment display.
If you want to display a decimal, this particular 7-segment display will allow you to do so. However, it will take up another output from your PIC.
Finally, if you are planning on displaying more than one digit, you will need an extra bit for every digit that you want to display.
There are three primary elements required for a circuit involving a 7-segment display.
The elements are:
1) the 7-segment display
2) the controller (in this case the PIC)
3) the decoder
The 7-segment display used in this demonstration is the LTD-4708JS which can display 2 digits with trailing decimal points. The controller is the PIC 18F4520. The decoder used is the HEF 4543B which takes one 4-bit binary input and converts it to the appropriate 7 logic outputs to drive the 7-segment display.
The LTD-4708JS 7-segment display has 10 pins. Seven pins correspond to the seven LED segments, one pin corresponds to the decimal point, and two pins select which digit is being activated. Both digits can be activated simultaneously, however they would not be able to display indepent digits in such a manner. To achieve multi-digit display, the digits must alternate back and forth at a rate preferably greater than 45 Hz for a complete cycle of display (approximately the flicker fusion frequency for the human eye, allowing it to appear that all displayed digits are on continuously).
The LTD-4708JS has 10 pins and they are designated as follows:
Pin 1: Segment "C"
Pin 2: Decimal Point
Pin 3: Segment "E"
Pin 4: Select pin for the second digit
Pin 5: Segment "D"
Pin 6: Segment "F"
Pin 7: Segment "G"
Pin 8: Segment "B"
Pin 9: Select pin for the first digit
Pin 10: Segment "A"
More to come . . .