Exp-01
Exp-01
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.
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.
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
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.
5. New window will be open by name select device for target target1
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
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.
14. New Text1 window (program window) will open and start writing code in assembly language
or in other.
MOV B,#03h
ADD A,B
END
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.
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
7. Then Keep the Reset Key on the 8951 Piggy Back module pressed continuously
10. Upon releasing the reset key on piggyback module, Reset Device window closes. This
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.
16. Various other functions as shown can be performed by clicking ISP Menu.
• 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.
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.
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
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
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
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
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.