JustPaste
HomeCategoriesAboutDonateContactTerms of UsePrivacy Policy
JustPaste

Free online notepad — write and share instantly

Navigate

  • Home
  • Timeline
  • Categories

Info

  • About
  • Donate
  • Contact

Legal

  • Terms of Use
  • Privacy Policy

© 2026 JustPaste.app. All rights reserved.

Made with ♥ by JustPaste

M11 | JustPaste.app
8 days ago22 views
👨‍💻Programming

M11

EXP:-1 Write an assembly language program to perform the mathematical operations tions of addition, subtraction, multiplication and division using immediate addressing mode using Keil

CODE:-

ORG 0000H

; Addition

MOV R0, #04H

MOV A, #02H

ADD A, R0 ; A = 02H + 04H = 06H

; Subtraction

MOV R0, #04H

MOV A, #02H

CLR C

SUBB A, R0 ; A = 02H - 04H = FEH

; Multiplication

MOV R0, #04H

MOV A, #02H

MOV B, R0

MUL AB ; B:A = 0008H

; Division

MOV B, #04H

MOV A, #02H

DIV AB ; A = Quotient, B = Remainder

END

EXP 2:- Write an assembly language age program to perform addition operation on two numbers using Immediate, Register, Direct, Register and Indirect Addressing modes

CODE:-

ORG 00H

MOV A,#04H

ADD A,#02H

MOV R0 , A

MOV A,#04H

SUBB A,#02H

MOV R1,A

MOV A,#04H

MOV B,#02H

MUL AB

MOV R2,A

MOV A,#04H

MOV B,#02H

DIV AB

MOV R3,A

END

EXP:-3 Write a Keil Program to Transfer Data from Internal Memory to External Memory, Internal to Internal Memory. External to Internal Memory using Keil.

CODE:-

ORG 0000H

        ; Internal to internal memory
        MOV 20H, #45H
        MOV A, 20H
        MOV 30H, A
        MOV R1, A

        ; Internal to external memory
        MOV 40H, #55H
        MOV A, 40H
        MOV DPTR, #2000H
        MOVX @DPTR, A

        ; External to internal memory
        MOV A, #65H
        MOV DPTR, #3000H
        MOVX @DPTR, A

        MOV DPTR, #3000H
        MOVX A, @DPTR
        MOV 50H, A

        MOV R2, #25H

HERE:   SJMP HERE

END

EXP :-4 Write a Program to find Even/Odd numbers in the given array using keil

CODE:-

MOV R0, #20H       ; Array pointer
        MOV R1, #05H       ; Loop counter
        MOV R2, #00H       ; Odd counter
        MOV R3, #00H       ; Even counter

CHECK:  MOV A, @R0
        RRC A              ; LSB moves to carry
        JC ODD
        INC R3             ; Carry = 0 -> even
        SJMP DOWN

ODD:    INC R2             ; Carry = 1 -> odd

DOWN:   INC R0
        DJNZ R1, CHECK

END

EXP:-5 Write an assembly language program to add two 16-bit numbers using keil

CODE:-

ORG 0000H

MOV A,10H

ADD A,12H

MOV 14H,A

MOV A,11H

ADDC A,13H

MOV 15H,A

JC CARRY

MOV 16H,#00H

JMP HERE

CARRY : MOV 16H,#01H

HERE : SJMP HERE

END

EXP:-6 Write an assembly language program for the 8051 microcontrollers to produce a 1 kHz square wave at pin P1.2 using Timer 0 in Mode 1, assuming crystal frequency of 12 MHz using keil

CODE:-

ORG 0000H

MAIN:   CPL P1.5
        ACALL DELAY
        SJMP MAIN

DELAY:  MOV TMOD, #01H
        MOV TL0, #18H
        MOV TH0, #0FCH
        SETB TR0


AGAIN:  JNB TF0, AGAIN

        CLR TR0
        CLR TF0
        RET

END

EXP:-7 Write an assembly language program for 8051 microcontrollers to demonstrate External Interrupt 1 and generate a pulse at Port 1.3 using keil

CODE:-

ORG 0000H
    LJMP MAIN

ORG 0013H
    LJMP ISR

ORG 0030H
MAIN:
    CLR P1.3          ; starts from logic zero / use SETB P1.3 to start from logic 1
    SETB P3.3         ; configure P3.3 (/INT1) pin as input
    SETB TCON.2       ; IT1 = 1: configure INT1 as edge-triggered
    SETB IE.2         ; EX1 = 1: enable External Interrupt 1
    SETB IE.7         ; EA = 1: enable Global Interrupts

HERE:
    SJMP HERE         ; idle wait loop waiting for external interrupt

ISR:
    CPL P1.3          ; Toggle P1.3 state on each interrupt
    RETI              ; Return from interrupt service routine

END

EXP:-8 Write an Assembly Language Program 8051 microcontroller to transfer text serially at 9600 baud rate using keil

CODE:-

ORG 0000H

MOV TMOD,#20H
MOV TH1,#0FDH
MOV SCON,#50H
SETB TR1

MOV DPTR,#MESSAGE

AGAIN:
    CLR A
    MOVC A,@A+DPTR
    JZ FINISH

    MOV SBUF,A

WAIT:
    JNB TI,WAIT
    CLR TI
    INC DPTR
    SJMP AGAIN

FINISH:
    SJMP FINISH

MESSAGE:
    DB 'T.E. VLSI 2026',00H

END

EXP:-9 Write an 8051 program to add the lower and higher nibbles of a number and display the result at the higher nibble of Port 1 on PT 51 Board.(P1.4 to p1.7)

CODE:-

ORG 0000H

MOV P1, #00H

MOV A, #29H

MOV R0, A

ANL A, #0FH

MOV R1, A

MOV A, R0

ANL A, #0F0H

SWAP A

ADD A, R1

ANL A, #0FH

SWAP A

MOV P1, A

HERE: SJMP HERE

END

EXP :- 10 Write an assembly language program for 8051 microcontroller to Turn LED on and off using timer and display the result on PT 51 Board.pp (P1.4 to P1.7).

CODE:-

ORG 0000H
LJMP MAIN

ORG 0030H

MAIN:
    MOV TMOD, #01H       ; Timer 0, Mode 1
    MOV P1, #00H         ; Initialize Port 1

LOOP:
    ORL P1, #0F0H        ; Turn ON LEDs P1.4-P1.7
    ACALL DELAY

    ANL P1, #00FH        ; Turn OFF LEDs P1.4-P1.7
    ACALL DELAY

    SJMP LOOP

; Timer 0 delay subroutine
DELAY:
    MOV R7, #10          ; Repeat 10 times

DELAY_LOOP:
    MOV TH0, #03CH       ; Load timer high byte
    MOV TL0, #0B0H       ; Load timer low byte
    CLR TF0              ; Clear overflow flag
    SETB TR0             ; Start Timer 0

WAIT:
    JNB TF0, WAIT        ; Wait for overflow

    CLR TR0              ; Stop Timer 0
    DJNZ R7, DELAY_LOOP  ; Repeat 10 times

    RET

END

JAY :-

ORG 0000H

MAIN:

CPL P1.0

ACALL DELAY

SJMP MAIN

DELAY:

MOV R7, #10

LOOP:

MOV TMOD, #01H

MOV TH0, #3CH

MOV TL0, #0B0H

SETB TR0

WAIT:

JNB TF0, WAIT

CLR TR0

CLR TF0

DJNZ R7, LOOP

RET

END

EXP :-11 Write an assembly language program for the 8051 microcontrollers to produce a 1 kHz square wave at pin P1.2 using Timer 0 in Mode 1, assuming crystal frequency of 12 MHz and display it on PT 51 Board

CODE:-

ORG 0000H

MAIN:   CPL P1.5
        ACALL DELAY
        SJMP MAIN

DELAY:  MOV TMOD, #01H
        MOV TL0, #18H
        MOV TH0, #0FCH
        SETB TR0


AGAIN:  JNB TF0, AGAIN

        CLR TR0
        CLR TF0
        RET

END

EXP:- POSITIVE AND NEGATIVE

CODE:-

MOV R0, #20H      ; Starting address
        MOV R1, #05H      ; Counter for 5 numbers
        MOV R2, #00H      ; Positive count
        MOV R3, #00H      ; Negative count

LOOP:   MOV A, @R0        ; Load number
        JB ACC.7, NEG     ; Check sign bit

POS:    INC R2            ; Increment positive count
        SJMP NEXT

NEG:    INC R3            ; Increment negative count

NEXT:   INC R0            ; Next memory location
        DJNZ R1, LOOP     ; Repeat for 5 numbers

STOP:   SJMP STOP         ; Stop program

← Back to timeline