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

Getting Started With Keil Uvision Compiler

The document describes the steps to create and run a program for the 8051 microcontroller using Keil μVision IDE. It involves creating a new project, adding a source code file, building the project to generate an object and hex file, and using Flash Magic software to download the hex file onto the microcontroller board and run the program. Key steps include selecting the Philips P89V51RD2 microcontroller, specifying the crystal frequency, building and debugging the project, and downloading the hex file through the serial port to the board's flash memory using Flash Magic before resetting the board to run the program.

Uploaded by

Ashish Pillai
Copyright
© Attribution Non-Commercial (BY-NC)
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)
322 views

Getting Started With Keil Uvision Compiler

The document describes the steps to create and run a program for the 8051 microcontroller using Keil μVision IDE. It involves creating a new project, adding a source code file, building the project to generate an object and hex file, and using Flash Magic software to download the hex file onto the microcontroller board and run the program. Key steps include selecting the Philips P89V51RD2 microcontroller, specifying the crystal frequency, building and debugging the project, and downloading the hex file through the serial port to the board's flash memory using Flash Magic before resetting the board to run the program.

Uploaded by

Ashish Pillai
Copyright
© Attribution Non-Commercial (BY-NC)
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/ 10

Universal Microcontroller Development Board

Creating applications for 8051 using Keil Vision compiler 1. Starting the Vision IDE: Click on START button and select Programs/Keil Vision. The screen should look something like this. There are 3 different windows viz. Editor window, Workspace window and output window as shown below.

2. To create a new project, from PROJECT menu, select NEW PROJECT. The screen should look something like this.

S2N Systems, Pune

Universal Microcontroller Development Board


3. The open dialog window will be displayed. Select the desired path where you wish to create this new project. Create new folder for every new project.

4. When you create a new project, Vision3 asks you to select a CPU for the project. The select device dialog box shows the Vision3 device database. Select the microcontroller Philips P89V51RD2.

S2N Systems, Pune

Universal Microcontroller Development Board


5. After the Project is created, the screen should look something like this.

6. To create a new source file either .asm or .c, from FILE menu, select NEW. The screen should look something like this.

S2N Systems, Pune

Universal Microcontroller Development Board


7. After editing the program in source file, save the source file with .asm extension (it is very must to give extension otherwise file is treated as normal text file.) in project folder.

8. Once the source file is created, add .asm file to your project. You can select the source group in the project workspace and files and click the right mouse key to open a local menu.

S2N Systems, Pune

Universal Microcontroller Development Board


9. The option Add files opens the standard files dialog. Select the desired file which is created.

10. After adding the file, go to options for the target to select the proper crystal frequency and Hex file creation. You can select the Target 1 in the project workspace and click the right mouse key to open a local menu.

S2N Systems, Pune

Universal Microcontroller Development Board


11. After selecting the options for Target, the screen should look something like this. Then type the desired clock frequency as shown below.

12. To check the options for creating the Hex file go to output tab of options for target window. Then specify the name of Hex file (default is project name) and check the box to create hex file as shown below.

S2N Systems, Pune

Universal Microcontroller Development Board


13. To build a project, go to PROJECT Build target, translate all source files and link the application with a click on the Build target toolbar icon. When you build an application with syntax errors, compiler will display errors and warning messages in the output window. A double click on a message line opens the source file on the correct location in editor window.

S2N Systems, Pune

Universal Microcontroller Development Board


14. After successful creation .obj file and .hex file go to DEBUG Start/stop debug session to debug / single step the program.

15. After clicking the start debug session, the screen should look something like this. To view the parallel ports, time/counter, interrupt go to Peripherals Menu. To view the memory window, serial window go to View Menu. To single step press F10.

S2N Systems, Pune

Universal Microcontroller Development Board


Downloading and running user programs Microcontroller P89V51RD2 includes on-chip flash, which is in-system programmable (ISP) for storing user program and non-volatile data. Therefore it is possible to download user program into on-chip flash, through serial port connected to PC. For this purpose software FLASH MAGIC is used. To down load the program using FLASH MAGIC follow the steps as below. 1. Connect the Power supply and keep the board in switched off mode. 2. Connect the RS232 port of trainer kit to COM1 of a PC using serial communication cable. 3. Start the flash magic by START PROGRAMS FLASH MAGIC Flash magic.exe. You will get the screen as below.

4. Do proper settings in flash magic (Device: P89V51RD2, COM port: COM1, Baud rate: 9600, Interface: None (ISP), enable erase block used by the HEX file. 5. Click on Verify after programming to verify the program. 6. Very Important: Do not select set security bit, Fill unused Flash, Gen block checksums, Prog Clocks bit. 7. Once the all settings are completed, select the Hex file which is to be downloaded.

S2N Systems, Pune

Universal Microcontroller Development Board


8. Use the browse option to go to the required directory. Click on the hex file you want to download to the target hardware.

9. After selection of the file. Click on the START button. Following message will be displayed.

10. At this point you should power ON the board. If the board is already powered ON, then you should press the reset switch on the board. 11. After the above, the above message will disappear and the programming will start. 12. Finally you will get the message on the bottom of the flash magic screen is finished. 13. To run the program, RESET the board or POWER OFF and POWER ON the board again.

S2N Systems, Pune

You might also like