| ??? 08/03/02 08:28 Read: times |
#26666 - code debug - timer |
Sorry. I have tried to debug for a long time. As a beginner, I do not familiar with assembly. I would like to seek help. The following problem is intended to implement a counter with 2 7-segments LED. One is connected to port 1 while the other one is connected to port 2.
The counting rule is count from 0.00s to 0.99s... but I found that the digits are not operated in what I have expected. --------- code is attached below ------ ORG 00H AJMP START ORG 0BH AJMP TM0_INT START: MOV P1, #01H ; INIT the display MOV P2, #01H ; INIT the display MOV SP, #60H MOV DPTR, #TABLE MOV R2, #0 SETB EA ; Enable interupt SETB ET0 ; Enable interupt of Timer0 MOV TMOD, #1 ; mode 1 MOV TH0, #ECH ; aimed for 0.01s counting MOV TL0, #78H SETB TR0 TM0_INT: CLR TR0 MOV TH0, #ECH MOV TL0, #78H ACALL UP ACALL CONV PUSH ACC MOV A, 20H ; save tenth digit MOVC A, @A+DPTR MOV P1, A MOV A, 21H ; save oneth digit MOVC A, @A+DPTR MOV P2, A POP ACC SETB TR0 RETI ; --- count up interupt subroutine --- UP: MOV A, R2 ADD A, #1 DA A MOV R2, A RETI ; --- converting two digits into two individual digit ; and save into 20H and 21H --- CONV: MOV A, R2 ; Extracting tenth digit ANL A, #F0H SWAP A MOV 20H, A ; save tenth digit MOV A, R2 ; Extracting oneth digit ANL A, #0FH MOV 21H, A ; save oneth digit RETI TABLE: DB 01H DB 4FH DB 12H DB 06H DB 4CH DB 24H DB 60H DB 0FH DB 00H DB 0CH END -------------------------------- Thank you very much Sunny |
| Topic | Author | Date |
| code debug - timer | 01/01/70 00:00 | |
| RE: code debug - timer | 01/01/70 00:00 | |
| RE: code debug - timer | 01/01/70 00:00 | |
| RE: code debug - timer | 01/01/70 00:00 | |
| RE: code debug - timer | 01/01/70 00:00 | |
RE: code debug - timer | 01/01/70 00:00 |



