0% found this document useful (0 votes)
2K views

Microcontroller & Embedded Systems Lab Manual Exp.1,2,3

Uploaded by

Akanksha Dixit
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2K views

Microcontroller & Embedded Systems Lab Manual Exp.1,2,3

Uploaded by

Akanksha Dixit
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 11

RAJIV GANDHI PROUDYOGIKI VISHWAVIDYALAYA, BHOPAL

New Scheme Based On AICTE Flexible Curricula

Electronics & Communication Engineering, VI-Semester

Open Elective EC- 604 (A) Microcontroller & Embedded system

UNIT-I

8051 Interfacing, Applications and serial communication

8051 interfacing to ADC and DAC, Stepper motor interfacing, Timer/ counter functions, 8051
based data acquisition system 8051 connections to RS-232, 8051 Serial communication, Serial
communication modes, Serial communication programming, Serial port programming in C.

UNIT II:

Microcontroller 8096 Introduction to 16-bit Microcontroller, functional block-diagram, memory


status, complete 8096 instruction set, classification of instruction set, addressing modes,
programming examples using 8096, hardware features of 8096,parallel ports, control &status
Registers, Introduction to 16/32 bit PIC microcontrollers and DSPIC.

UNIT-III

Introduction to Embedded Systems:

Definition of embedded system, embedded systems vs. general computing systems, history of
embedded systems, classification, major application areas, purpose of embedded systems,
characteristics and quality attributes of embedded systems, common design metrics, and
processor technology: general purpose processor, application specific processor, single purpose
processor.

UNIT-IV
Embedded System Architecture:
Von Neumann v/s Harvard architecture, instruction set architecture, CISC and RISC
instructions set architecture, basic embedded processor, microcontroller architecture, CISC &
RISC examples: 8051, ARM, DSP processors.

UNIT-V

Input Output and Peripheral Devices


Timers and counters, watchdog timers, interrupt controllers, PWM, keyboard controller, analog
to digital converters, real time clock.

Reference Books:
1. Muhammad Ali Mazidi and Janice Gillespie Mazidi, The 8051 Microcontroller and Embedded
Systems, Pearson education, 2005.
2. Kenneth J. Ayala, The 8051 Microcontroller Architecture, III edition, CENGAGE Learning.

3. V. Udayashankara and M.S. Mallikarjunaswamy, 8051 Microcontroller: Hardware, Software &


Applications, Tata McGraw - Hill, 2009.

4. McKinlay, The 8051 Microcontroller and Embedded Systems - using assembly and C, PHI, 2006 /
Pearson, 2006.

5. Tim Wilmshurst, Designing embedded system with PIC microcontrollers Principles and applications.
2nd ed. 2011 Bsp books pvt lt

6. Shibu K V, “Introduction to Embedded System”, TMH.

7. David E Simon, “An Embedded Software Primer”, Pearson education Asia, 2001.

8. Steven F. Barett, Daniel J. Pack, “Embedded Systems” Pearson education, First Impression2008.
RAJIV GANDHI PROUDYOGIKI VISHWAVIDYALAYA, BHOPAL

New Scheme Based On AICTE Flexible Curricula Electronics

& Communication Engineering VI-Semester

EC- 606 MICROCONTROLLER & EMBEDDED SYSTEM LAB

 1. Programming using arithmetic, logical and bit manipulation instructions of 8051.


 2. Program and verify Timer/Counter in 8051.
 3. Communication between 8051 kit and PC.
 4. To study development tools/environment for ATMEL/PIC microcontroller program and
Architecture.
 5. Write an ALP to generate square of 10Khz using Timer 0.
 6. Write an ALP to display a string on LCD.
 7. Write an ALP to interface seven segment with 8051 and display 0-9 on it.
 8. Write an ALP to interface DC Motor with 8051
 9 Write an ALP to transmit the data using P1 of 8051
 10. Write an ALP to interface 4x4 keyboard with 8051.
 11. Write an ALP to interface temperature sensor using 8051
 12. Write an ALP to interface the lcd 16x2 to P16f877A

 As per Keil software available in department.


Experiment No.-1

Aim- Study of 8051.

Description

The AT89C51 is a low-power, high-performance CMOS 8-bit microcomputer with 4K bytes of Flash
programmable and erasable read only memory (PEROM). The device is manufactured using Atmel’s high-density
nonvolatile memory technology and is compatible with the industry-standard MCS-51 instruction set and pinout.
The on-chip Flash allows the program memory to be reprogrammed in-system or by a conven- tional nonvolatile
memory programmer. By combining a versatile 8-bit CPU with Flash on a monolithic chip, the Atmel AT89C51 is
a powerful microcomputer which provides a highly-flexible and cost-effective solution to many embedded control
applications.

Features
• Compatible with MCS-51™ Products
• 4K Bytes of In-System Reprogrammable Flash Memory
– Endurance: 1,000 Write/Erase Cycles
• Fully Static Operation: 0 Hz to 24 MHz
• Three-level Program Memory Lock
• 128 x 8-bit Internal RAM
• 32 Programmable I/O Lines
• Two 16-bit Timer/Counters
• Six Interrupt Sources
• Programmable Serial Channel
• Low-power Idle and Power-down Modes

Pin Configurations
Block Diagram

P0.0 - P0.7 P2.0 - P2.7

VCC

PORT 0 DRIVERS PORT 2 DRIVERS


GND

RAM ADDR. PORT 0 PORT 2


REGISTER RAM LATCH LATCH FLASH

PROGRAM
B STACK ADDRESS
REGISTER ACC POINTER REGISTER

BUFFER
TMP2 TMP1

PC
ALU INCREMENTER

INTERRUPT, SERIAL PORT,


AND TIMER BLOCKS

PROGRAM
PSW COUNTER

PSEN
ALE/PROG TIMING
AND INSTRUCTION REGISTER DPTR
EA / VPP CONTROL
RST

PORT 1 PORT 3
LATCH LATCH

OSC
PORT 1 DRIVERS PORT 3 DRIVERS

P1.0 - P1.7
P3.0 - P3.7
Pin Description Port 0
Port 0 is an 8-bit open-drain bi-directional I/O port. As
an output port, each pin can sink eight TTL inputs.
VCC
When 1s are written to port 0 pins, the pins can be
Supply voltage. used as high- impedance inputs.
Port 0 may also be configured to be the multiplexed
GND low- order address/data bus during accesses to external
Ground. pro- gram and data memory. In this mode P0 has
internal pullups.
Port 0 also receives the code bytes during Flash P3.1 TXD (serial output port)
program- ming, and outputs the code bytes during P3.2 INT0 (external interrupt 0)
program verification. External pullups are required P3.3 INT1 (external interrupt 1)
during program verification.
P3.4 T0 (timer 0 external input)
P3.5 T1 (timer 1 external input)
Port 1
P3.6 WR (external data memory write strobe)
Port 1 is an 8-bit bi-directional I/O port with internal P3.7 RD (external data memory read strobe)
pullups. The Port 1 output buffers can sink/source
four TTL inputs. When 1s are written to Port 1 pins Port 3 also receives some control signals for Flash
they are pulled high by the internal pullups and can be pro- gramming and verification.
used as inputs. As inputs, Port 1 pins that are
externally being pulled low will source current (IIL) RST
because of the internal pullups. Reset input. A high on this pin for two machine
Port 1 also receives the low-order address bytes cycles while the oscillator is running resets the
during Flash programming and verification.
device.
Port 2
Port 2 is an 8-bit bi-directional I/O port with internal
ALE/PROG
pullups. The Port 2 output buffers can sink/source
four TTL inputs. When 1s are written to Port 2 pins Address Latch Enable output pulse for latching the
they are pulled high by the internal pullups and can low byte of the address during accesses to external
be used as inputs. As inputs, Port 2 pins that are memory. This pin is also the program pulse input
externally being pulled low will source current (IIL) (PROG) during Flash programming.
because of the internal pullups. In normal operation ALE is emitted at a constant rate
Port 2 emits the high-order address byte during of 1/6 the oscillator frequency, and may be used for
fetches from external program memory and during external tim- ing or clocking purposes. Note,
accesses to external data memory that use 16-bit however, that one ALE pulse is skipped during each
addresses (MOVX @ DPTR). In this application, it access to external Data Memory.
uses strong internal pullups when emitting 1s.
During accesses to external data mem- ory that use If desired, ALE operation can be disabled by setting
8-bit addresses (MOVX @ RI), Port 2 emits the bit 0 of SFR location 8EH. With the bit set, ALE is
contents of the P2 Special Function Register. active only dur- ing a MOVX or MOVC instruction.
Port 2 also receives the high-order address bits and Otherwise, the pin is weakly pulled high. Setting the
some control signals during Flash programming and ALE-disable bit has no effect if the microcontroller is
verification. in external execution mode
PSEN
Port 3 Program Store Enable is the read strobe to external
Port 3 is an 8-bit bi-directional I/O port with internal pro- gram memory.
pullups. The Port 3 output buffers can sink/source When the AT89C51 is executing code from external
four TTL inputs. When 1s are written to Port 3 pins pro- gram memory, PSEN is activated twice each
machine cycle, except that two PSEN activations are
they are pulled high by the internal pullups and can skipped during each access to external data memory.
be used as inputs. As inputs, Port 3 pins that are
externally being pulled low will source current (IIL) EA/VPP
because of the pullups.
External Access Enable. EA must be strapped to GND
Port 3 also serves the functions of various special
in order to enable the device to fetch code from
features of the AT89C51 as listed below:
external pro- gram memory locations starting at 0000H
up to FFFFH. Note, however, that if lock bit 1 is
Port Pin Alternate Functions
programmed, EA will be internally latched on reset.
P3.0 RXD (serial input port)
EA should be strapped to V CC for internal
program executions.
This pin also receives the 12-volt programming
enable volt- age (VPP) during Flash programming, for
parts that require 12-volt VPP.

XTAL1
Input to the inverting oscillator amplifier and input to
the internal clock operating circuit.

XTAL2

Output from the inverting oscillator amplifie


Experiment No.-2

Aim- WAP for blinking of led’s.


Apparatus required- System with basic configuration, keil software, protious software.
Theory-
A light-emitting diode (LED) is a semiconductor light source that emits light when current flows
through it. Electrons in the semiconductor recombine with electron holes, releasing energy in
the form of photons. The color of the light (corresponding to the energy of the photons) is
determined by the energy required for electrons to cross the band gap of the
semiconductor. White light is obtained by using multiple semiconductors or a layer of light-
emitting phosphor on the semiconductor device.

Program-

I-Program for alternate blinking of leds all the bits of P2.

#include<reg51.h>
void delay(unsigned int itime);
void main()
{
P2=0x55;
delay(100);
P2=0xaa;
delay(100);
}
void delay(unsigned int itime)
{
unsigned int i,j;
for(i=0;i<=itime;i++)
for(j=0;j<=1275;j++);
}

II-Program for two group of blinking of leds all the bits of P2.

#include<reg51.h>
void delay(unsigned int itime);
void main()
{
P2=0xcc;
delay(100);
P2=0x33;
delay(100);
}
void delay(unsigned int itime)
{
unsigned int i,j;
for(i=0;i<=itime;i++)
for(j=0;j<=1275;j++);
}

III-Program for four group of blinking of leds all the bits of P2.

#include<reg51.h>
void delay(unsigned int itime);
void main()
{
P2=0xf0;
delay(100);
P2=0x0f;
delay(100);
}
void delay(unsigned int itime)
{
unsigned int i,j;
for(i=0;i<=itime;i++)
for(j=0;j<=1275;j++);
}

Result- Led blinking program and simulation completed successfully.


Experiment No.-3

Aim- WAP for displaying 0-9 on seven segments.


Apparatus required - System with basic configuration, keil software, protious software.
Theory- A seven-segment display is a form of electronic display device for
displaying decimal numerals that is an alternative to the more complex dot matrix displays.
Seven-segment displays are widely used in digital clocks, electronic meters, basic calculators,
and other electronic devices that display numerical information.

Program for displaying 0-9 using port 2

#include<reg51.h>
void Delay(unsigned int itme);
void main( )
{
while(1)
{
P2=0xc0;
Delay(100);
P2=0xf9;
Delay(100);
P2=0x24;
Delay(100);
P2=0xb0;
Delay(100);
P2=0x99;
Delay(100);
P2=0x92;

Delay(100);
P2=0x02;
Delay(100);
P2=0x78;
Delay(100);
P2=0x00;
Delay(100);
P2=0x01;
Delay(100);
}
}
void Delay(unsigned int itime)
{
unsigned int i,j;
for(i=0;i<=itime;i++)
for(j=0;j<=1275;j++);
}

Result- Program for displaying 0-9 on seven segment and there simulation on protious successfully
completed.

You might also like