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

Skill Basic Assembly Coding

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

Skill Basic Assembly Coding

asdf
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

skill No.

- 2

Title: To develop Assembly language program for 8051 architecture

Aim/objective 1) To develop simple assembly codes


2) Programming logic for running light one LED at a time.
3) Programming for running light two LEDs at a time.
Apparatus/ Tools/ Equipment’s/ Resources used- PPT for explanation of practical, , keil

Theory- (Explain 3 different instructions used program (syntax, function, memory, machine cycle and
flags affected if applicable)

Procedure:
Part A: write and simulate assembly language program
Enter the program in keil and observe the contents of A in step by step execution
org 0000h;

; mov R1, #40h;

; mov R5, #04h;

;mov B, R5;

; CLR A;

;up1: add A, @R1;

;inc R1;

; DJNZ R5, up1;

; mov R2, A;

; end

;------------------------------

;mov R0, #40h;

;mov R1, #50h;

;MOV R2, #05H;

;up1: mov A,@R0;

;mov @R1,A;

1
;NC R0;

;INC R1;

;inc R1;

;DJNZ R2, up1;

;end

;------------------------------------------------

Do not write this

; Short jump code

MOV P1,#0FFH

MOV A,P1

CJNE A, #50H, DOWN1; CARRY FLAG IS 0 IF ACCUMULATOR CONTENTS ARE GREATER


THAN 50h, AND CARRY FLAG IS 1 IF ACCUMULATOR CONTENTS ARE SMALLER THAN 50 HCONTENTS ARE
LESS

SJMP END1

DOWN1: JNC DOWN2

MOV R1,A;

SJMP END1

DOWN2: MOV R2,A

END1:

END;

;----------------------------------------------

PART B

;1) Programming logic for running light one LED at a time.

;2) Programming for running light two LEDs at a time.

;logic1 for running light one LED at a time

;Logic 1

;MOV A,#01H;

;MOV P1,#00H;

;nxt:

2
;MOV R0,A

;MOV P1,A

;ADD A,R0;

;SJMP nxt

;END

;logic2

;MOV P1,#00H;

;MOV A,#01H;

;nxt:MOV P1,A

; RLC A;

;SJMP nxt

;END

;----------------------------------

;Two led flashing

; MOV P1,#00H;

; MOV A, #03H;

;up1 : MOV P1,A

; RL A

; RL A

; SJMP UP1

;mvi C, ff H

; DCR C

; jnz up1

; END

calculations / results
For LED flashing Logic 1

3
1) What are the contents of accumulator after 6 th step of execution: -------------.

For LED flashing Logic 2

2) What are the contents of accumulator after 8 th step of execution: -------------.

3) Two led flashing

2) What are the contents of accumulator after 8 th step of execution: -------------.

Conclusion : Developed assembly code f LED flashing written and executed.

You might also like