Professional Documents
Culture Documents
08
(b) to toggle bits of Port 1 (P1) continuously with some time delay.
OUTCOME: Students will learn how to use Keil compiler for writing
program and its execution.
Theory:
Keil is a German software which was the first C compiler designed from
the ground-up specifically for the 8051 microcontrollers. Using Keil
software it is easy to perform the assembly as well as C programs.
Program (a):
FLOWCHART (a):
OUTPUT (a):
Program (b):
Toggling refers to the process of changing the state of a digital signal or a pin
from high to low or vice versa. The 8051 microcontroller has special function
registers (SFRs) that are used to control the I/O ports, and manipulating these
registers allows you to toggle pins. The reg51.h header file is specific to 8051
microcontrollers and contains definitions for various registers and special
function registers (SFRs) used in 8051 programming. There is also an infinite
loop. The absence of loop initialization and condition creates an infinite loop,
which means the code inside it will run continuously. This is a simple delay
loop. It increments the variable x until it reaches the value 40000. The loop acts
as a delay mechanism, and the actual delay introduced depends on the
execution speed of the microcontroller and the number of iterations in the
loop.After configuring P1 with 0xAA, the program enters into another infinite
loop, continuing to execute the code inside indefinitely. The overall behavior of
the program is to continuously alternate the values 0x55 and 0xAA on the P1
port with a delay loop in between. This kind of code is often used to generate a
simple pattern on an output port for testing or demonstration purposes. The
actual timing and visual effects depend on the specific hardware and clock
frequency of the microcontroller.
PROGRAM (b) :
FLOWCHART (B):
OUTPUT (B):
CONCLUSION:
Thus, we have performed the C program of 8051 microcontroller using Keil software for