ESD Lab Revised

Preview:

DESCRIPTION

embedded system lab file

Citation preview

INDEXS no.TOPICDone OnTeachers Sign

1.Program to toggle LEDs alternatively interfaced to Port 1 of 8051 Microcontroller.

2.Program to display a string on a set of Seven Segment Displays interfaced to 8051 microcontroller.

3. Program to print a string on a set of Seven Segment Displays interfaced to PIC 16F84A Microcontroller.

4.Program to print a string on LCD interfaced to PIC 16F84A Microcontroller.

5.Program to blink 8 LEDs ON and OFF interfaced to Port 1(16-23) of LPC2148 ARM7 Microcontroller.

6.Program to toggle LEDs alternatively interfaced to Port 1(16-23) of LPC2148 ARM7 Microcontroller.

7.Program to print HELLO on Seven Segment Display interfaced to LPC2148 ARM7 Microcontroller

8.Program to print 12345 on Seven Segment Display interface to LPC2148 ARM7 Microcontroller.

EXPERIMENT NO. 1

Aim: Program to toggle LEDs alternatively interfaced to Port 1 of 8051 Microcontroller.

Software Used: C51 V1.20.01

Theory:The Intel MCS-51 (commonly referred to as 8051) is a Harvard architecture, CISC instruction set, single chip microcontroller (C) series which was developed by Intel in 1980 for use in embedded systems. The 8051 architecture provides many functions (CPU, RAM, ROM, I/O, interrupt logic, timer, etc.) in a single package 8-bit ALU and Accumulator, 8-bit Registers (one 16-bit register with special move instructions), 8-bit data bus and 2x16-bit address bus/program counter/data pointer and related 8/11/16-bit operations; hence it is mainly an 8-bit microcontroller Boolean processor with 17 instructions, 1-bit accumulator, 32 registers (4 bit-addressable 8-bit) and up to 144 special 1 bit-addressable RAM variables (18 bit-addressable 8-bit) Multiply, divide and compare instructions fast switchable register banks with 8 registers each (memory mapped) Fast interrupt with optional register bank switching Interrupts and threads with selectable priority Dual 16-bit address bus It can access 2 x 216 memory locations 64kB (65536 locations) each of RAM and ROM 128 bytes of on-chip RAM (IRAM) 4 KiB of on-chip ROM, with a 16-bit (64 KiB) address space (PMEM). Not included on 803X variants Four 8-bit bi-directional input/output port UART (serial port) Two 16-bit Counter/timers Power saving mode (on some derivatives)

In order to toggle LEDs using 8051, the PORT is first set as output port by setting the bits(0xff).The PORT is then alternatively given a Hexadecimal value of 0x55 and 0xAA with a small delay for glowing the LEDs alternatively.

Program Code:#include #include

//Program to Blink LED Alternatively

void delay(void);void main(void){//Initialize port as output P1 = 0xff;P1 = 0xaa;

while(1){P1 = 0x55;delay();P1 = 0xaa;delay();}}

void delay() //Delay Function{ int i=0,j=0; for(i=0;i