Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Read the code and the comments carefully to understand each step of the pr ogram. The program uses a simple loop (ik100000000) loop as a
Read the code and the comments carefully to understand each step of the pr ogram. The program uses a simple loop (ik100000000) loop as a delay to slow the changes sent to the LEDs to allow us to see them. As a first exercise, modify the for loop to wait a much shorter time by changing the value 100000000 to 1000 and run the program again. You will see that the speed has increased to the point where all the LEDs appear to be lit and flashing. /* Define 8051 registers / /* Delay variable */ /* Loop forever */ # include void main (void) unsigned int i while (1) P3 0x00; for (i-100000000; P0 = 0xff; for (i=100000000; PO0x00: LED Port P3 * /* Output FF to the LED Port */ / Output 00 to the LED Port */ /* End while(1) loop */ i0; i) i>0; ?--) / End of main / Exercise 1 Extend the supplied example to light all LEDs. Later, in exercise 5, you will need to create a rotating bit pattern, rather than one going up and then down. This will be harder as the variable you'll be using will hold 16-bits, but you will only be working with the bottom 8
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started