Calculation of lookup table as follows:
The lookup table contains the input pattern for the LED legs, to display the corresponding digits.
The table shows the seven segment requirement pattern to display the Hex number, with the Seven segment conversion.
For example, Let us consider the display of the number 0, where we need to switch ON all the LEDs which are there at the boundary. i.e. for a CC LED, we should supply 5 volts to these LEDs. The 6 LEDs (‘a’ through ‘f’) should get binary 1, the dot and the (middle) hyphen segment should get 0Volts or the binary Zero. Effectively the Seven segment pattern code will be (0011 1111) 3Fh. That is what we OUT through the port pins.
For a Common Anode LED, the display pattern will be the complement of that of Common Cathode pattern.
For Common Cathode :

For common Anode:

ASM program:
This program displays characters 0 through 9 on seven-segment display connected directly to the port 2 of the microcontroller Intel8951.
Here, the look up table is stored from the memory location 19H of the microcontroller. The first set is the pattern code for common anode followed by the common cathode.
//Look up table for common Anode org 0000 mov r0,#19h mov @r0,#0c0fh // Code for the digit 0 inc r0 mov @r0,#0f9h // Code for the digit 1 inc r0 mov @r0,#0a4h // Code for the digit 2 inc r0 mov @r0,#0b0h // Code for the digit 3 inc r0 mov @r0,#099h // Code for the digit 4 inc r0 mov @r0,#092h // Code for the digit 5 inc r0 mov @r0,#082h // Code for the digit 6 inc r0 mov @r0,#0f8h // Code for the digit 7 inc r0 mov @r0,#0f0h // Code for the digit 8 inc r0 mov @r0,#98h // Code for the digit 9 //Look up table for common Cathode org 0000 mov r0,#19h mov @r0,#0bfh inc r0 mov @r0,#86h inc r0 mov @r0,#0dbh inc r0 mov @r0,#0cfh inc r0 mov @r0,#0e6h inc r0 mov @r0,#0edh inc r0 mov @r0,#fdh inc r0 mov @r0,#87h inc r0 mov @r0,#0ffh inc r0 mov @r0,#0e7h again: mov a,#00h ; Start form zero up: mov r2,a mov r0,#19h ; Load starting address of luck up table add a,r0 mov r0,a mov a,@r0 ; Get the LED equivalent mov p2,a ; Move to Port 2 mov r3,#255 ; Delay D1: mov r1,#255 D: djnz r1,D djnz r3,D1 mov a,r2 inc a cjne a,#0ah,up sjmp again
Pages: 1 2
Description :
This is the one stop educational site for all Electronic and Computer students. If you want to learn something new then we are here to help. We work on Microcontroller projects, Basic Electronics, Digital electronics, Computer projects and also in basic c/c++ programs.
#Home #Sitemap #Submit #Terms of Use
Copyright©2011 electrofriends.com All Rights Reserved
Contact:info@electrofriends.com | Powered by Dhyeya
May 20th, 2009 at 1:40 pm
need a AT89C51 microcontroller compiler
August 17th, 2009 at 7:03 pm
[...] Using lookup table. This uses 7 output pins of microcontroller [...]
September 10th, 2009 at 7:10 am
do you have pcb diagram of 7 segment
April 25th, 2010 at 2:56 pm
its nice.please send me the details about this project.thankuuuu.
my email id:rajeshkannapwf@gmail.com
May 31st, 2010 at 10:19 am
really a nice detail provided…itz working for me…
October 30th, 2010 at 2:52 pm
i have to make this project but i don;t how to programme ….in my project there is a one switch at input..when i press switch counter will increasde by one……….it should be happend till 0 to 9…please help me to resolvr this problem…my project name is micro controller based counter
November 15th, 2010 at 1:40 am
wht is difference between connecting 7447 decoder to 7 segment display
and connecting 7 segment display directly to 8051 using ports?
March 4th, 2011 at 8:08 am
i want 3digit 7segment displays interfacing with 89s52 using the C . if any one knows please send it to my mail kongara_ramakrishna13@yahoo.co.in