You are on page 1of 5

Lab report # 01

Fatima Sadiq
12pwcse1029
Section : B
Sir Ammad Khalil

Microcontroller:

A microcontroller is a small and low-cost computer built for the purpose of dealing with
specific tasks, such as displaying information in a microwave LED or receiving information from
a televisions remote control. Microcontrollers are mainly used in products that require a degree
of control to be exerted by the user.

Difference between Microcontroller & Microprocessor:

Microprocessors are used to execute big and generic applications, while a microcontroller will
only be used to execute a single task within one application. Some of the benefits of
microcontrollers include the following:
Cost advantage: The biggest advantage of microcontrollers against larger microprocessors is that
the design and hardware costs are much lesser and can be kept to a minimum. A microcontroller
is cheap to replace, while microprocessors are ten times more expensive.
Lesser power usage: Microcontrollers are generally built using a technology known as
Complementary Metal Oxide Semiconductor (CMOS). This technology is a competent
fabrication system that uses less power and is more immune to power spikes than other
techniques.
All-in-one: A microcontroller usually comprises of a CPU, ROM, RAM and I/O ports, built
within it to execute a single and dedicated task. On the other hand, a microprocessor generally
does not have a RAM, ROM or IO pins and generally uses its pins as a bus to interface to
peripherals such as RAM, ROM, serial ports, digital and analog IO.

How does a Microcontroller work?


Microcontroller has an input device in order to get the input and an output device (such as LED
or LCD Display) to exhibit the final process. The Television has a remote control as an Input
device and the TV screen as the output device. The signal sent from the remote control is
captured by the microcontroller. The microcontroller controls the channel selection, the amplifier
system and picture tube adjustments such as hue, brightness, contrast etc.

LAB:
In lab well use AT89C51 and AT89C52.

Basic Circuit:

Software:
We will use keil software.
Creating Project:
1.Startup the keil
2.click on the project -> select new u vision project ->select the ATMEL and Select
either AT89C51 or AT89C52 and then ok.
3.Then right click on source group and add new file either C or assembly.
4:Write a code save it and build it. And then debug it.
5.Select peripheral and port number.
6.and Run it.
Hex File Generation:

1. Right click on source file then select Options for Target .


2. Select the Output tab.
3. Make sure the Create HEX File check box is checked.
4. Select the proper HEX file format to create (typically this will be HEX-80 for 8051
programs and HEX-386 for large C16x programs).

Then through burner program load the controller with that hex file and check it on
bread board.
First Program:
Code.C
#include<REG51.H>
void main(void)
{
int A;
while(1)
{
A=0xff;
P1=A;
P2=A;
A=0x00;
P1=A;
P2=A;
}
}

You might also like