A 7segment display is just a set of seven LED bars contained

A 7-segment display is just a set of seven LED bars contained in a convenient package, as shown below. They are generally provided in two different packages: common cathode (CC) and common anode (CA). The common-cathode package ties both the COM terminals together, which then needs to be connected to GND: each LEO segment can be illuminated by applying positive voltage to the individual anodes (i.e, write a \'I\' to a port pin connected to that LED segment. The common-anode package ties both the COM terminals together, which then needs to be connected to V_cc: each LED segment can be illuminated by applying GND to the individual cathodes (i.e. write a \"0\" to a port pin connected to that LED segment. Your task is to write a complete C program that will continuously display numbers 0 to 9 on the 7-segment LED with a delay of 1 second between each display. You will use the following pin configurations: You should be able to find the 7-segment from your EGR106 toolkit. Make sure your program works on the hardware.

Solution

void main();
int i,j;
for(i=0;i<100;i++);
for(j=0;j<1000;j++);
{
while(1)
{
P1= 0x3f;// display 0
delay();
P1=0x06;// display 1
delay();
P1=0x5b;// display 2
delay();
P1=0x4f;// display 3
delay();
P1=0x66;//display 4
delay();
P1=0x6d;//display 5
delay();
P1=0x7d;//display 6
delay();
P1=0x07;//display 7
delay();
P1=0x7f;//display 8
delay();
P1=0x6f;//display 9
delay();
}
}
void delay();

*// 0x3f is hex code for 1111110 that is 0

 A 7-segment display is just a set of seven LED bars contained in a convenient package, as shown below. They are generally provided in two different packages: c

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site