0% found this document useful (0 votes)
10 views

1. Led Glowing (2)

Uploaded by

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

1. Led Glowing (2)

Uploaded by

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

Microcontroller and Embedded System

Lab
(ECN14104)

NAME: - SREYA MAITRA


REGISTRATION NUMBER :- 20224161
BRANCH:- ECE (C2)
Experiment No. 1

Objective: To install and configure mikroC software, FLASH programmer and its
drivers and understand some LED controls of 8051.

Equipment used: 8051 microcontroller , mikroC , FLASH.

Theory:

1.Basic Installation process:


• mikroC PRO :- Visit https://www.mikroe.com/easy8051 to install the zip

file .

o Extract it and run the .exe file to install the software

• FLASH programmer

o From the same site install the zip file for FLASH software o

Extract it and then run the .exe file

• USB Drivers

o Install the zip file for the drivers from the same site, extract it run the .exe file to open the
installation dialog box to install the drivers.

Connecting the system to PC:

• Use the USB cable to connect to the Easy 8051 v6 development system to your PC and turn on the
POWER SUPPLY switch to ON position.

• Two LEDs referred to as POWER and USB LINK will illuminate to indicate that your development
system is ready to use

• Use the on-board 8051(mikroC) programmer and 8051 flash program to dump a code into the
microcontroller and empty the board to test and develop your project.

2.8051 microcontroller :

• It is an 8-bit microcontroller with 4 KB of ROM, 128 bytes of RAM, four 8- bit I/O ports, two 16-bit
timers, and a serial interface.

• It is based on the Harvard architecture, which means it has separate program and data memory34.
• It is a CISC (Complex Instruction Set Computer) microcontroller, which means it has a large number
of instructions and addressing modes.

• It is widely used in embedded systems, such as automation, medical devices, touch screens, etc.

• It has a serial interface that allows communication with other devices such as computers, modems,
printers, etc.

• It supports both synchronous and asynchronous modes of data transfer.

• The 8051 microcontroller has a built-in oscillator circuit that can be connected to an external
crystal or a ceramic resonator.

• The 8051 microcontroller has a special function register (SFR) area that contains various control
and status registers.

C program to turn on and off all the LEDs:

* NOTES:

- Turn ON the PORT LEDs (SW7).

- On Easy8051v6 LEDs are activated by logical zero

*/

void main() {

do {

P0 = 0x00; // Turn ON diodes on PORT0

P1 = 0x00; // Turn ON diodes on PORT1

P2 = 0x00; // Turn ON diodes on PORT2

P3 = 0x00; // Turn ON diodes on PORT3

Delay_ms(5000); // 1 second delay

P0 = 0xFF; // Turn OFF diodes on PORT0

P1 = 0xFF; // Turn OFF diodes on PORT1

P2 = 0xFF; // Turn OFF diodes on PORT2

P3 = 0xFF; // Turn OFF diodes on PORT3

Delay_ms(5000); // 1 second delay

} while(1); // Endless loop

Procedure to execute it:

• Click on the build and program (ctrl + F11) to generate the .hex file
• A FLASH programmer dialog box will appear.
• Select the device frequency as 10MHz and click on write to load the program in
microcontroller.

Observation:

LED Curtain C program:

char counter;

void wait() {

Delay_ms(5000);

void main() {

P0 = 0xFF; // Turn OFF diodes on PORT0

P1 = 0xFF; // Turn OFF diodes on PORT1

P2 = 0xFF; // Turn OFF diodes on PORT2

P3 = 0xFF; // Turn OFF diodes on PORT3

while (1) {

for (counter = 0; counter < 8; counter++){

P0 |= 1 << counter;

P1 |= 1 << counter;

P2 |= 1 << counter;
P3 |= 1 << counter;

wait();

counter = 0;

while (counter < 8) {

P0 &= ~(1 << counter);

P1 &= ~(1 << counter);

P2 &= ~(1 << counter);

P3 &= ~(1 << counter);

wait();

counter++;

Observation:

Result:

The program is performed successfully and verified the output.

You might also like