Types of 7 segment display
Above Tutorial will help you in determining which seven segment you are using anode or cathode. You will be familiarize with the pin out and internal structure of the seven segment display. The upper tutorial will also explain you what are the pros and cons of using anode and cathode seven segment displays.
7 segment display with 8051 microcontroller – circuit diagram
8051 microcontroller port-1 interfaced with 7 segment – Individual pin connections
How numbers and characters are displayed on 7 segment display?
Like P1=0xCF is equivalent to 11001111(C=1100 and F=1111) in binary. This instruction makes f & e(P1.5 and P1.4) pins of seven segment ground and the corresponding led’s to these pins becomes high. which prints 1 on the seven segment display.
Below are the full instructions used to display numbers and alphabets on the 7 segment display. These instructions are hard coded in the code.
- Making 1- f e is grounded P1=0xCF; 11001111
- Making 2- a b g e d is grounded P1=0xA4; 10100100
- Making 3- a b c d g is grounded P1=0xB0; 10110000
- Making 4- b c f g is grounded P1=0x99; 10011001
- Making 5- a c d f g is grounded P1=0x92; 10010010
- Making 6- a c d e f g is grounded P1=0x82; 10000010
- Making 7- a b c is grounded P1=0xF8; 11111000
- Making 8- a b c d e f g is grounded P1=0x00; 00000000
- Making 9- a b c f g is grounded P1=0x98; 10011000
- Making A- a b c e f g is grounded P1=0x88; 10001000
- Making B- a b c d e f g is grounded P1=0x00; 00000000
- Making C- a d e f is grounded P1=0xC6; 11000110
- Making D- a b c d e f is grounded P1=0xC0; 11000000
- Making E- a d e f g is grounded P1=0x86; 10000110
- Making F- a e f g is grounded P1=0x8E; 10001110
7 segment with 89c51 microcontroller – Code
Note: If you are using Common cathode seven segment display the upper commands will be same just make a little change turn 0(zeros) to 1(ones) and 1(ones) to 0(zeros) because common cathode lit its leds when any pin is high.
The while 1 loop is continuously running our seven segment display. Means continuously printing characters and numbers on it.