HCS12 Use the sevensegment LEDs to display the following seq

HCS12: Use the seven-segment LEDs to display the following sequence of digits with each sequence lasting for half a second:

1

2 1

3 2 1

4 3 2 1

5 4 3 2

6 5 4 3

7 6 5 4

8 7 6 5

9 8 7 6

0 9 8 7

1 0 9 8

2 1 0 9

3 2 1 0

After display these once, repeat sequence 4 to 13 forever.

Solution

for (i=1;i<=3;i++)

{

for(j=i; j<=i; j++)

{

PTP=digit[ j ]; //o/p digit value

delaybyms(0.5); //hlf a second delay

}

}

while(TRUE){

for (i=1;i<=9;i++)

{

for(j=i; j<=i-3; j++) //first and last digits\' diff is 3

{

PTP=digit[ j ]; //o/p digit value

puts(PTP); //display

delaybyms(0.5); //hlf a second delay

}

}

for (k=4;k>=1;k--)

{

for(i=4-k;i>=0;i--)

{

PTP=digit[ j ]; //o/p digit value

puts(PTP); //display

delaybyms(0.5); //hlf a second delay

}

}

} //end of while

HCS12: Use the seven-segment LEDs to display the following sequence of digits with each sequence lasting for half a second: 1 2 1 3 2 1 4 3 2 1 5 4 3 2 6 5 4 3
HCS12: Use the seven-segment LEDs to display the following sequence of digits with each sequence lasting for half a second: 1 2 1 3 2 1 4 3 2 1 5 4 3 2 6 5 4 3

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site