Vous êtes sur la page 1sur 5

Using Keil uVision 5 FOR 8051

1. Download and Install Keil uVision5


2.Open Keil uVision

3. Create a new Project : Project >> Create Vision


Project

4.
5.
6.
7.
8.

Browse for the location


Select the microcontroller Atmel>>AT89C51
Dont Add The 8051 startup code
File>>New
Adding Hex file to the output

Right click on Target1>>options for target target

1
In the Output Tab check the Create HEX file box<

Program 1: To complement a number and perform


addition
Org 0000h
MOV A,#03H
CPL A
ADD A,#01H
END
Program2: store the higher nibble of r7 in to both
nibbles of r6
Mov r7,#23H
Mov a, r7
Anl a, #0F0h
Mov r6, a
Swap a
acc

; get the content in acc


; mask lower
; send it to r6
; Exchange upper and lower nibbles of

Orl a, r6
Mov r6, a

; OR operation
; finally load content in r6

END
Program 3: MULTIPLY 25 BY 10 USING THE
TECHNIQUE OF REPEATED ADDITION
MOV A,#0;
MOV R2,#10
AGAIN:ADD A,#25
DJNZ R2,AGAIN
MOV R5,A
END
Program 4: Write a program to (a) load the
accumulator with the value 55h and complement
the ACC 700 times
MOV A,#55H
MOV R3,#10
NEXT:MOV R2,#70
AGAIN : CPL A
DJNZ R2,AGAIN
DJNZ R3,NEXT

Program 5: WRITE A PROGRAM TO COPY THE VALUE


55H INTO RAM MEMORY LOCATIONS 40H TO 45H
USING LOOP
MOV A,#55H
MOV R0,#40H
MOV R2,#05H
AGAIN:MOV @R0,A
INC R0
DJNZ R2,AGAIN
END
Program 6: WRITE A PROGRAM TO FIND THE
FACTORIAL OF A GIVEN NUMBER
ORG 0000
MOV R1,#04
MOV R7,#01
LCALL FACT
MOV R7,A
FACT:
MOV A,R7
CJNE R1,#00,UP
SJMP UP1
UP:
MOV B,R1
MUL AB
DJNZ R1,UP
UP1:

RET
END

//GIVEN NUMBER STORED IN R1 REGISTER


//RESULT IS STORED IN R7 REGISTER
//RESULT IS IN HEXADECIMAL
//FACTORIAL UP TO 5 CAN BE FOUND

Vous aimerez peut-être aussi