| ??? 02/21/00 05:34 Read: times |
#1547 - Please help me check the source code. |
Can help me check this source code. It is about optical encoder interfacing wiht 8051 and display result on a LED.
.ORG 0H JMP MAIN .ORG 50H MAIN: MOV R1, #10H CALL DISPLAY MOV P0, #0FFH ;SET PORT 0 AS INPUT GET00: MOV A, P0 ANL A, #00000011B CJNE A, #00H, GET00 DIRECTION: MOV A, P0 ANL A, #00000011B CJNE A, #01H, NEXT ; CHECK CHANNEL A = 1 JMP CW ; JUMP TO CLOCKWISE NEXT: CJNE A, #02H, DIRECTION ; CHECK CHANNEL B = 1 JMP CCW ; JUMP TO ANTI-CLOCKWISE CW: INC R1 ; INCREMENT R1 CJNE R1, #1AH, NEXT1 ; CHECK COUNT = 10 JMP MAIN ; LOOP BACK TO RESET COUNT CCW: DEC R1 ; DECREMENT R1 CJNE R1, #10H, NEXT1 ; CHECK COUNT = 0 CJNE R1, #1FH, NEXT2 JMP MAIN ; LOOP BACK TO RESET COUNT NEXT1: CALL DISPLAY ; CALL FOR DISPLAY SUBROUTINE JMP GET00 ; LOOP BACK TO READ AGAIN NEXT2: MOV R1, #19H CALL DISPLAY JMP GET00 DISPLAY: MOV P1, R1 CALL DELAY RET DELAY: MOV R5, #35H F: MOV R4, #07H E: MOV R3, #0FFH D: DJNZ R3, D DJNZ R4, E DJNZ R5, F RET END |
| Topic | Author | Date |
| Please help me check the source code. | 01/01/70 00:00 | |
| RE: Please help me check the source code. | 01/01/70 00:00 | |
| RE: Please help me check the source code. | 01/01/70 00:00 | |
RE: Please help me check the source code. | 01/01/70 00:00 |



