Interfacing Seven Segment Display on 8051- C Code { Common Anode}

This code is a simple one . Here just a 7 seg display is attached to Port 0 of 8051 micro controller . The values can be calculated easily .
One unit of 7 seg display has 7 different leds as its segments and also a dot at the bottom left corner. Hence the 8 data lines are connected to P0 and the following values are passed to get the required number to be displayed on the display .


Common Cathode
Common Anode

There are two types of 7 seg. common anode and common cathode,depending upon which one u buy the values change . Just change those values according to the above table.you can refer data sheet to understand the exact difference between them.