LED1 BIT P2.0 CSEG AT 0 SJMP MAIN CSEG AT 0003H CPL LED1 RETI MAIN: MOV IE,#81H ;EA=EX0=1 SETB IT0 ;for edge triggered MOV A,#01H AGAIN: MOV P1,A RL A SJMP AGAIN END
Showing posts with label ALP. Show all posts
Showing posts with label ALP. Show all posts
Saturday, 6 December 2014
ALP Program for edge trigger in 8051
Posted by Madan
Posted on 23:49
Write an assembly programming code to implement 60sec timer
Posted by Madan
Posted on 23:28
$INCLUDE(DELAY100.ASM) $INCLUDE(SEG.ASM) CSEG AT 0 MAIN: MOV DPTR,#LUT MOV R4,#0 AGAIN: MOV A,R4 MOV B,#10 DIV AB MOVC A,@A+DPTR MOV SEG1,A MOV A,B MOVC A,@A+DPTR MOV SEG2,A ACALL DELAY100MS INC R4 CJNE R6,#60,AGAIN SJMP MAIN END
Write an ALP program to perform rotation right with carry operation.
Posted by Madan
Posted on 23:20
Write an ALP program for 4x4 matrix keypad
Posted by Madan
Posted on 22:11
ROW0 BIT P3.0 ROW1 BIT P3.1 ROW2 BIT P3.2 ROW3 BIT P3.3 COL0 BIT P3.4 COL1 BIT P3.5 COL2 BIT P3.6 COL3 BIT P3.7 KEYPAD_LUT SEGMENT CODE RSEG KEYPAD_LUT KCODE0: DB 1,2,3,4 KCODE1: DB 5,6,7,8 KCODE2: DB 9,+,-,* INIT_ROWS: CLR ROW0 CLR ROW1 CLR ROW2 clr row3 RET INIT_COL: SETB COL0 SETB COL1 SETB COL2 SETB COL3 RET COLSCAN: SETB C ANL C,COL0 ANL C,COL1 ANL C,COL2 ANL C,COL3 RET CSEG AT 0 MAIN: KEYSCAN: ACALL INIT_COL ACALL INIT_ROWS SCAN_COLS: ACALL COLSCAN JNC KEYPRESSED SJMP SCAN_COLS KEYPRESSED: CLR ROW0 SETB ROW1 SETB ROW2 SETB ROW3 ACALL COLSCAN JNC ROW_0 SETB ROW0 CLR ROW1 SETB ROW2 SETB ROW3 ACALL COLSCAN JNC ROW_1 SETB ROW0 SETB ROW1 CLR ROW2 SETB ROW3 ACALL COLSCAN JNC ROW_2 SETB ROW0 SETB ROW1 SETB ROW2 SETB ROW3 ACALL COLSCAN JNC ROW_2 ROW_0: MOV DPTR,#KCODE0 SJMP COLCHECK ROW_1: MOV DPTR,#KCODE1 SJMP COLCHECK ROW_2: MOV DPTR,#KCODE2 SJMP COLCHECK COLCHECK: MOV R3,#0 JNB COL0,MAPKEY INC R3 JNB COL1,MAPKEY INC R3 JNB COL2,MAPKEY MAPKEY: MOV A,R3 MOVC A,@A+DPTR MOV P2,A IS_KEY_PRESSED: ACALL COLSCAN JNC IS_KEY_PRESSED SJMP MAIN END
3x3 Matrix Keypad ALP Program
Posted by Madan
Posted on 22:07
;$INCLUDE(KEYPADHEAD.ASM) ;$include(reg51.h) $include(DELAY100.ASM) ROW0 BIT P3.0 ROW1 BIT P3.1 ROW2 BIT P3.2 COL0 BIT P3.4 COL1 BIT P3.5 COL2 BIT P3.6 KEYPAD_LUT SEGMENT CODE RSEG KEYPAD_LUT KCODE0: DB 1,2,3 KCODE1: DB 4,5,6 KCODE2: DB 7,8,9 INIT_ROWS: CLR ROW0 CLR ROW1 CLR ROW2 RET INIT_COL: SETB COL0 SETB COL1 SETB COL2 RET COLSCAN: SETB C ANL C,COL0 ANL C,COL1 ANL C,COL2 RET ;CSEG AT 0 ;MAIN: KEYSCAN: ACALL INIT_COL ACALL INIT_ROWS SCAN_COLS: ACALL COLSCAN JNC KEYPRESSED SJMP SCAN_COLS KEYPRESSED: CLR ROW0 SETB ROW1 SETB ROW2 ACALL COLSCAN JNC ROW_0 SETB ROW0 CLR ROW1 SETB ROW2 ACALL COLSCAN JNC ROW_1 SETB ROW0 SETB ROW1 CLR ROW2 ACALL COLSCAN JNC ROW_2 ROW_0: MOV DPTR,#KCODE0 SJMP COLCHECK ROW_1: MOV DPTR,#KCODE1 SJMP COLCHECK ROW_2: MOV DPTR,#KCODE2 SJMP COLCHECK COLCHECK: MOV R3,#0 JNB COL0,MAPKEY INC R3 JNB COL1,MAPKEY INC R3 JNB COL2,MAPKEY MAPKEY: MOV A,R3 MOVC A,@A+DPTR MOV P2,A IS_KEY_PRESSED: ACALL COLSCAN JNC IS_KEY_PRESSED RET ;SJMP MAIN ;END CSEG AT 0 MAIN: ACALL KEYSCAN ;MOV P1,A ;IS_KEY_PRESSED: ;ACALL COLSCAN ;JNC IS_KEY_PRESSED SJMP MAIN END
Friday, 5 December 2014
Loop based Indirect Addressing Assembly Language Program
Posted by Madan
Posted on 23:45
Program to perform loop based operation along with indirect addressing
cseg at 0 ; code segment base address from location 0
mov 55h,#11h ; Hex value 11h will be moved into the memory location 55
mov r0,55h ; register r0 points to memory location 55
mov r1,#3 ; register r1 contains value 3
loop:
clr a ; accumulator will be cleared
inc r0 ; r0 will be incremented
add a,@r0 ; value at memory location 55 will be added with accumulator
djnz r1,loop ;decrement and jump if not equal to zero. loop continue until r0 becomes zero
End
cseg at 0 ; code segment base address from location 0
mov 55h,#11h ; Hex value 11h will be moved into the memory location 55
mov r0,55h ; register r0 points to memory location 55
mov r1,#3 ; register r1 contains value 3
loop:
clr a ; accumulator will be cleared
inc r0 ; r0 will be incremented
add a,@r0 ; value at memory location 55 will be added with accumulator
djnz r1,loop ;decrement and jump if not equal to zero. loop continue until r0 becomes zero
End
ALP Program to perform addition operation in memory bank 2
Posted by Madan
Posted on 23:05
Write an ALP(Assembly Language Program) program to select Memory Bank2 and perform addition operation Over there.
cseg at 0 //code segment starting memory address at 0
mov a,#55h //Hex 55 will be moved into accumulator add a,#65h //accumulated value will be added with hex 65 and result will be stored in accumulator setb psw.4 // 4th bit of program status word will be set clr psw.3 // 3rd bit of program status word will be cleared mov r4,a // finally acculator result will be stored in register r4 end
Subscribe to:
Posts (Atom)
















