0% found this document useful (0 votes)
104 views13 pages

Exp-01

This document describes an experiment to install and use simulation software tools for 8051 microcontroller programming. The objectives are to understand the simulation tools KEIL-μvision5 and PROTEUS 8 and use them to perform experiments on 8051 hardware. The document explains how to install and use both tools to write, compile, simulate, and debug code for the 8051 microcontroller. It also provides details about the 8051 trainer kit hardware and the features of the P89V51RD2 microcontroller used.

Uploaded by

Prisha Singhania
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)
104 views13 pages

Exp-01

This document describes an experiment to install and use simulation software tools for 8051 microcontroller programming. The objectives are to understand the simulation tools KEIL-μvision5 and PROTEUS 8 and use them to perform experiments on 8051 hardware. The document explains how to install and use both tools to write, compile, simulate, and debug code for the 8051 microcontroller. It also provides details about the 8051 trainer kit hardware and the features of the P89V51RD2 microcontroller used.

Uploaded by

Prisha Singhania
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/ 13

Name: Prisha Singhania Date: 25/09/2022

SAP ID: 60002200135 Batch: TE2-4


Experiment No.:1

Title: To study and install simulation software tools (Keil-µvision5 and Proteus 8
Professional) for 8051 microcontroller programming.

Objectives: At the end of this experiment, students will be able to perform experiments on hardware,
understood simulation tools and their uses for 8051 programming.

Hardware: 8051 Trainer Kit, USB to Serial converter cable and connecting wires.

Simulation Software: KEIL-µvision5, PROTEUS8.

Theory:
Embedded system means some combination of computer hardware and programmable software
which is specially designed for a particular task like displaying message on LCD. It involves hardware
(8051 microcontroller) and software (the code written in assembly language).

The μVision IDE is a window-based software development tool that combines project management
and a rich-featured editor with interactive error correction, option setup, make facility, and on-line
help. Use μVision to create source files and organize them into a project that defines your target
application. The μVision IDE is the easiest way for most developers to create embedded applications
using the Keil development tools. The new Keil μVision5 IDE has been designed to enhance
developer's productivity, enabling faster, more efficient program development.

This software is an integrated development environment (IDE), which integrated a text editor to write
programs, a compiler and it will convert your source code to hex files too.

Subject: Microprocessor & Microcontroller TE/SEM-V Page No.


μVision Integrated Development Environment (IDE)

C Compiler
The Keil Cx51 Compiler is a full ANSI implementation of the C programming language and supports
all standard features of the C language. In addition, numerous extensions have been included to
directly support the 8051 and extended 8051 architecture.
Macro Assembler
The Keil Ax51 Macro Assembler supports the complete instruction set of the 8051 and all 8051
derivatives.
Library Manager
The LIBx51 Library Manager allows you to create the object library from object files created by the
compiler and assembler. Libraries are specially formatted, ordered program collections of object
modules that may be used by the linker at a later time. When the linker processes a library, only those
object modules necessary to create the program are used.
Linker/Locater
The Lx51 Linker/Locater creates the final executable 8051 program and combines the object files
created by the compiler or assembler, resolves external and public references, and assigns absolute
addresses. In addition, it selects and includes the appropriate run-time library modules.
μVision Debugger

Subject: Microprocessor & Microcontroller TE/SEM-V Page No.


The μVision Debugger is ideally suited for fast and reliable program debugging. The debugger
includes a high-speed simulator capable of simulating an entire 8051 system including on-chip
peripherals and external hardware.

The μVision Debugger provides several ways to test programs on target hardware:
1. Use the Keil ULINK USB-JTAG adapter for downloading and testing your program. Install a
target monitor on your target system and download your program using the built-in monitor
interface of the μVision Debugger.
2. Use the Advanced GDI interface to attach and use the μVision Debugger front end with your
target system.

Procedure: A) For KEIL- µvision5

1. Open µvision5 window

2. Create folder on desktop.

3. Click on PROJECT tab and select new µvision project.

4. Save new project by name in created desktop folder.

5. New window will be open by name select device for target target1

6. In search tab type AT89c51.

7. Select microchip AT89c51 and click on OK.

8. Message will display copy STARTUP.A51 to project folder and Add file to project. Click on
YES tab.

9. In main window, project sub-window will display which shows your Project
name__Target1_Source group1_STARTUP.A51

10. Click on Target1 and select option for target target1.

11. New window will open indicates selected microcontroller crystal frequency 24MHz, memory
model, code ROM size, operating system and off chip code memory. Do not change default
setting.

Subject: Microprocessor & Microcontroller TE/SEM-V Page No.


12. In same window, click on OUTPUT tab, Tick on create Hex file and then click on OK.
13. Click on FILE tab in main window and select new file

14. New Text1 window (program window) will open and start writing code in assembly language
or in other.

Type this program: MOV A,#02h

MOV B,#03h

ADD A,B

END

15. Save program by file name.asm

16. Right click on source group1 option in target window, select add existing to group source
group1 and select program file i.e file name.asm from folder. Click on Add tab and close it.

17. Click on PROJECT tab and select Build Target option.

18. In down side build output window will appear. It shows creating hex file and error message
is any. Don’t care of warning message if error shown 0

19. Click on DEBUG tab in main window and select start/stop session. Message will display
EVALUATION MODE, running with code size limit:2K. Click on OK.

20. New window will open which shows all internal register contents at left side window,
Middle part is related to program code along with hex code and right hand side downward
shows memory1 option.

21. According to our small program addition result stored in Accumulator A. check result in
register window. i.e A=02h B=03h result after addition is in A=05h

B) For Flash Magic (8951 ISP Programmer Setup)


1. Install flash magic in your computer.
2. Run flash Magic from desktop.

3. Select “Device” 80C51 P89V51RD2 in STEP 1 - Communication window


Com port – com 1
Baud rate – 9600
Interface – None (ISP)

Subject: Microprocessor & Microcontroller TE/SEM-V Page No.


4. Connect Serial cable between CN12 (9 pin connector) to PC - COM port using 9 Pin Serial
Cable.
5. Press Reset Key which resets the Processor and gets into ISP Mode
6. Select “ISP” from Menu Bar Device Configuration Factory Default(Wait for auto-baud
after reset)

7. Then Keep the Reset Key on the 8951 Piggy Back module pressed continuously

8. Press the Program button on the configuration window.

Subject: Microprocessor & Microcontroller TE/SEM-V Page No.


9. Release the Reset Key on piggyback module.

10. Upon releasing the reset key on piggyback module, Reset Device window closes. This

indicates that the kit is communicating with PC

11. Now your Kit is ready to write the program on the device

12. Now select your file to download using browse in STEP 3 – Hex file window.

13. After loading your file press “Start” in STEP 5 – Start window.

14. After completion of programming press reset Key. This resets the Processor and Mode gets

Changed.

15. As the system is in Application Mode the downloaded application program starts executing.

Note: All sample Codes are available in Code directory.

16. Various other functions as shown can be performed by clicking ISP Menu.

P89V51RD2 EMBEDDED TRAINER

➢ CPU: Philips P89V51RD2 operating @ 11.0592 MHz

• 64 KB of on-chip Flash program memory

• Supports 12-clock (default) or 6-clock mode selection via software or ISP

• SPI (Serial Peripheral Interface) and enhanced UART

• PCA (Programmable Counter Array) with PWM and Capture/Compare functions

• Three 16-bit timers/counters

Subject: Microprocessor & Microcontroller TE/SEM-V Page No.


• Programmable Watchdog timer (WDT)

• Eight interrupt sources with four priority levels

• Second DPTR register Low EMI mode (ALE inhibit)


• On-chip 32 I/O Lines (Four 8-bit I/O ports) are provided in 40 pin Connector ISP
(In-System Programming) and IAP (In-Application Programming) facility On-board
Reset Key Onboard Applications

• 8 LED’s to display Digital Output.

• 8 Switches to give Digital Input indicated by LED’s.

• 16x2 Alphanumeric LCD backlit display.

• 4 digit seven segment displays.

• I 2C compatible: - 24C512 EEPROM (64KB) - DS1307 RTC with suitable battery -


4Ch. 8bit ADC & 1Ch. 8 bit DAC using PCF8591

Temperature sensor interface using LM35.

• Temperature sensor interface using DS18B20.

• 24 I/O Lines Provided on a 26 pin FRC Connector for external interface. On board

supply +/- 12V, 5V. is provided. Supply Input Voltage: 230V AC. All ICS are

mounted on IC Sockets. Bare board Tested Glass Epoxy SMOBC PCB is used.
User's Manual with `C’ source code sample programs for all on board applications.

Subject: Microprocessor & Microcontroller TE/SEM-V Page No.


CIRCUIT DESCRIPRION FOR ONBOARD MODULES:

1. 16 x 2 CHARACTER LCD:

Reset (RST) of LCD is connected with P3.0 of 51MCU, READ/WRITE (R/W) of LCD is
connected with P3.1 of 51MCU, Enable (E) of LCD is connected with P3.2 of 51MCU and
Data Lines of LCD (D0-D7) is connected with P1.0 – 1.7 of 51MCU. Set the switches as
explained in table1. Message “WELCOME TO KITEK TECHNOLOGIES MUM” will be
displayed on LCD on execution of Program.

Subject: Microprocessor & Microcontroller TE/SEM-V Page No.


2. 8 INPUT DIP switches:

Input Switches IP1-8 is connected to its corresponding LEDs (I1-8) and to the Processor at
Pins P0.0- P0.7, Set the switches as explained in table1 On execution of Program the Output
will be displayed on LCD. The output will in Binary Form. It will indicate the status of
Switch by displaying 0 and 1 where “Switch On” is 1 and “Switch Off” is 0. It also displays
Hex equivalent of the input

3. 8 LED indicators:

Output LED O1-O8 is connected to the Processor at Pins P1.0-P1.7 Set the switches as
explained in table1. On execution of Program, the Four LEDs, i.e. O1 - O4 will glow and after
fixed interval the other four i.e. O5-O8 will glow and so on

Subject: Microprocessor & Microcontroller TE/SEM-V Page No.


4. 7-SEGMENT:

The seven segments, D0- D7 of 7 segment display is connected to P1.0 – P1.7 of 51 MCU.
Selection of display is done through a decoder 74138. Input to the decoder is provided by
P3.0.P3.1 & P3.2 of 51 MCU. When 000 is given display-1 is selected, 001 then display -2,
010 then display-3 and 011 then display - 4. Set the switches as explained in table1. On
execution of Program “GOOd” will be displayed by the four seven segments.

5. ADC_DAC:

Channel 1 of ADC (PCF8591) is connected to analog IN (AIN) through JP5. Input to channel
is selectable i.e. can be external input through AIN1 or can be LM35. The output is provided
through I2C BUS to 8051 microcontroller at P2.2 & P2.3. Four channel Data will be

Subject: Microprocessor & Microcontroller TE/SEM-V Page No.


displayed on LCD. Set the switches as explained in table1. On execution of Program it will
display PCF 8591 ADC & DAC … then it will show OBSERVE DAC O/P AT ‘AOUT’ then
it will show 4 SINGLE ENDED ANALOG I/P … then finally it will show “AI1 = AI2 = AI3
= AI4 =” on 16 X 2 LCD display

6. SERIAL EEPROM:

The output is provided through I2C BUS to 8051 microcontroller at P2.1, P2.2 & P2.3. Set
the switches as explained in table1. On execution of Program it will display “I2C EEPROM
IC MEMORY TEST” then it will show PAGE SIZE 128 BYTE then WRITING 0…127 IN
EACH PAGE then it will display PAGE NO = - 511 WRITING DONE then NOW
READING ALL PAGES then PAGE NO = 400 – 511 READING MATCHES then finally it
will show I2C MEMORY TEST OK on 16 X 2 LCD display

7. DS18B20 TEMP SENSOR:

Subject: Microprocessor & Microcontroller TE/SEM-V Page No.


DS18B20Temperature Sensor is connected to the 8051 Microcontroller through Pin P2.0.
Keep SW3 ON condition. Set the switches as explained in table1. On execution of Program
it will display E87 - 01 P89V51RD2 EMBEDDED TRAINER - 33 - “TEMPERATURE
MEASUREMENT” and then “1 WIRE PROTOCOL DS18B20” and then
“TEMPERATURE in CELSIUS = ROOM Temperature” will be displayed on 16 X 2 LCD
display.

8. LM35 TEMP SENSOR:

Set the switches as explained in table1. The Jumper JP5 should be fixed at 1 &2. On execution
of Program it will display “LM35 TEMPERATURE SENSOR and then LM35
TEMPERATURE D CELSIUS: 37 will be displayed on 16 X 2 LCD display

9. RTC:

The output is provided through I2C ROM to 8051 microcontroller at P2.3 & P2.2. Between
Pin 1, & Pin 2 Crystal is connected Pin 3 is connected to Battery. Set the switches as explained
in table1. On execution of Program it will display “REAL TIME CLOCK DS1307” then it
will show WANT TO SET NEW DATE/TIME Y/N to enter new Date and Time press key
KB1 else KB2. On pressing KB1 then it will show SETTING NEW DATE & TIME DATE:
31/12/2009 TIME 23:59:00 if KB2 pressed then it will display READING RTC DATE &
TIME on 16 X 2 LCD display

Subject: Microprocessor & Microcontroller TE/SEM-V Page No.


CONNECTOR CN10 DETAILS

Conclusion:
• In this experiment, we have learnt to write code for microcontroller using assembly
programming language. Assembly language uses ‘.asm’ extension.
• We converted assembly to hex code using Keil-µvision5.
• The kit we were using was designed by Atmel (AT89C51RD2 model).
• When we build target for the code file it generates hex-code file in the same folder.
• The hex-code file generated can be imported into the microcontroller using FlashMagic
software.

Subject: Microprocessor & Microcontroller TE/SEM-V Page No.

You might also like