panda1234
Full Member level 2
![Full Member level 2](/styles/images/ranks/elevel2.gif)
Hi,
I want assembly code that is get a two digit number from user(from matrix keypad) and then Save it in R7 and R6 registers.
I write below code but this is not work true for second digit.
I want assembly code that is get a two digit number from user(from matrix keypad) and then Save it in R7 and R6 registers.
I write below code but this is not work true for second digit.
Code ASM - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 ORG 0 LJMP MAIN EX0ISR: CJNE R0,#0,Number_2 ACALL Scan MOV A,R1 MOV R7,A MOV R2,#1 RETI Number_2: CJNE R2,#1,Nothing ACALL Scan MOV A,R1 MOV R6,A MOV R0,#2 RETI Nothing: RETI ORG 00100H MAIN: MOV A,#00000111B MOV P2,A MOV IE,#85H SETB IT0 SETB IT1 MOV A,R6 MOV P1,A SJMP MAIN Scan: MOV A,#11111111B MOV P2,A CLR P2.0 JB P2.3,J1 MOV R1,#3 RET J1: JB P2.4,J2 MOV R1,#6 RET J2: JB P2.5,J3 MOV R1,#9 RET J3: JB P2.6,J4 MOV R1,#10 RET J4: SETB P2.0 CLR P2.1 JB P2.3,J5 MOV R1,#2 RET J5: JB P2.4,J6 MOV R1,#5 RET J6: JB P2.5,J7 MOV R1,#8 RET J7: JB P2.6,J8 MOV R1,#0 RET J8: SETB P2.1 CLR P2.2 JB P2.3,K1 MOV R1,#1 RET K1: JB P2.4,K2 MOV R1,#4 RET K2: JB P2.5,K3 MOV R1,#7 RET K3: JB P2.6,K4 MOV R1,#11 RET K4: RET END
Last edited by a moderator: