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

Iot

The document provides steps to create and compile a project in Keil μVision for 8051 microcontrollers. It describes opening Keil, creating a new project, adding source files, setting target options, building and debugging the project, and viewing output.

Uploaded by

SANDHIYA S
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
46 views

Iot

The document provides steps to create and compile a project in Keil μVision for 8051 microcontrollers. It describes opening Keil, creating a new project, adding source files, setting target options, building and debugging the project, and viewing output.

Uploaded by

SANDHIYA S
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 11

STEPS TO CREATE AND COMPILE Keil µVision-3/4/5 PROJECT:

1. Double click on the keil icon on the desktop.


2. Close any previous projects that were opening using project—>close.
3. Start Project – New Project, and select the CPU from the device database (Database-

Atmel- AT89C51ED2 or AT89C51RD2 as per the board).On clicking ‘OK’, the


following option is displayed. Choose ‘No’.

4. Create a source file (using File->New), type in the assembly or C program and save

this (filename.asm/filename.c) and add this source file to the project.


using either one of the following two methods. (i) Project->Manage-

>Components, Environment Books->addfiles-> browse to the required file - >


OK “OR” ii) right click on the Source Group in the Project Window and the Add Files to

Group option.

5. Set the Target options using -> Project – Options for Target opens the µ Options for
Target – Target configuration dialog. Set the Xtal (Crystal frequency) frequency to
11.0592 MHz, and also the Options for Target– Debug – use either Simulator / Keil
Monitor- 51 driver.

6. If Keil Monitor- 51 driver is used, click on Settings -> COM Port settings select the
COM Port to which the board is connected and select the baud rate as 19200 or 9600
(recommended). Enable Serial Interrupt option if the user application is not using on-chip
UART, to stop program execution.

7. Build the project; using Project -> Build Project. application and links. Any errors in
the code are indicated by – “Target not created” in the Build window, along with the
error line. Debug the errors. After an error free, to build go to Debug mode.

8. Now user can enter into Debug mode with Debug- Start / Stop Debug session dialog. Or
by clicking on the icon.
9. The program is run using the Debug-Run command & halted using Debug-Stop
Running. Also, the (reset, run, halt) icons can be used. Additional icons are (step, step
over, and step into, run till cursor).
10.If it is an interface program the outputs can be seen on the LCD, CRO, motor, led status,
etc. If it is a part-A program, the appropriate memory window is opened using View -
> memory window (for data RAM & XRAM locations), Watch window (for
timer program), serial window, etc.
11.Note: To access data RAM area type address as D: 0020h. Similarly, to access the DPTR
region (XRAM-present on chip in AT89C51ED2) say 9000h location type inX:09000H.
EXP NO:01
Write 8051 Assembly language experiments using Simulator
DATE:

AIM:

To Write 8051 assembly language experiments using simulator.

PROCEDURE:

1. Initialize the program.


2. This program follows the previously mentioned steps to create and compile the project.
3. Load the immediate data 5 to the accumulator A.
4. Load the immediate data 4 to the register R0.
5. Add the content of the register R0 to Accumulator A.
6. Move the result from the accumulator A to memory location 50 H.
7. End the program.
8. To see the output go to memory window and enter the memory location like D:50H.

PROGRAM: OUTPUT

RESULT:

Thus the assembly language program for 8051 simulators has been executed successfully.
EXP NO:02a

DATE:
Test data transfer between registers and memory

AIM:

To write and execute an Assembly language program to transfer data between register.

PROCEDURE:

1. Initialize the program.


2. This program follows the previously mentioned steps to create and compile the project.
3. Load the immediate data #7,#1,#5 to the register R0,R1,R2.
4. Load the contents of the register R0 to the memory location 50H.
5. Load the contents of the register R1 to the memory location 51H.
6. Load the contents of the register R2 to the memory location 52H.
7. End the program.
8. To see the output go to memory window and enter the memory location like D:50H.

PROGRAM: OUTPUT:

RESULT:
Thus the assembly language program to test data transfer between register and memory has
been executed successfully.
EXP NO:02b
Test data transfer between memory and register
DATE:

AIM:

To write an assembly language program to test data transfer between memory and register.

PROCEDURE:

1. Initialize the program.


2. This program follows the previously mentioned steps to create and compile the project.
3. Load the contents of the register R0 to the memory location 50H.
4. Load the contents of the register R1 to the memory location 51H.
5. Load the contents of the register R2 to the memory location 52H.
6. Load the immediate data #7, #1, #5 to the register R0, R1, R2.
7. End the program.
8. To see the output go to memory window and enter the memory location like D:50H.

PROGRAM: OUTPUT:

RESULT:
Thus the assembly language program to test data transfer between memory and register
has been executed successfully.
EXP NO:03
Perform ALU Operations
DATE:

AIM:

To write an assembly language program to perform ALU operations.

PROCEDURE:

1. Initialize the program.


2. This program follows the previously mentioned steps to create and compile the project.
3. Perform arithmetic operations like addition, subtraction, multiplication and division.
4. Also perform logical operations such as AND, OR & EX-OR.
5. Return their result.
6. End the program.
7. To see the output go to memory window and enter the memory location like D:50H.

PROGRAM: OUTPUT:

RESULT:
Thus the assembly language for ALU operations has been executed successfully.
EXP NO:4a
Write Basic Program Using Embedded c
DATE:

AIM:
To write basic and arithmetic programs using embedded c.

PROCEDURE:
1. Initialize the program.
2. This program follows the above-mentioned steps to create and compile the project.
3. Includes the necessary header file reg51.h.
4. Declares two integer variables i and j and LED as a single bit located at pin P2.0.
5. The main () function contains an infinite loop.
6. Inside the loop, it turns on the LED by setting ‘LED’ to 0, then waits for delay using a
‘for’ loop.
7. After the delay, it turns off the LED by setting LED to 1, then waits for another delay.
8. The pattern repeats indefinitely, resulting in the LED blinking on and off with a delay
between each transition.
9. End the program.
10.To see the output go to peripherals and open I/O ports which was declared.

PROGRAM: OUTPUT:

Note: output port2 blinked when the program started


running

RESULT:
Thus, the basic embedded c program has been executed successfully.
EXP NO:4b
Write arithmetic program using Embedded C
DATE:

AIM:
To write a arithmetic program using Embedded c.

PROCEDURE:
1. Initialize the program.
2. This program follows the above-mentioned steps to create and compile the project.
3. Define the variables used for arithmetic program.
4. Declare two 8-bit numbers.
5. Perform arithmetic operation for each two 8-bit numbers.
6. Store declare port as a output port.
7. End the program.
8. To see the output go to peripherals and open I/o port which was declared.

PROGRAM:
OUTPUT:

RESULT:
Thus the arithmetic program using Embedded C has been executed successfully.

You might also like