| ??? 01/28/03 07:24 Read: times |
#37460 - RE: 5 Sec delay |
Here is example for one sec delay
make a loop to 10secs this works on timer one interrupt you may have modify the same. ; ****** FILE XAMPLE11.A51 ********************************* ; IE EQU 0A8H ACC EQU 0E0H PSW EQU 0D0H TCON EQU 088H ; new : Timer/Counter Control TMOD EQU 089H TL0 EQU 08AH TH0 EQU 08CH ; ; 250*100*40 microsec = 1 sec T0valu EQU 25 ; 250 microsec for TIMER 0 TIME1 EQU 10 ; no. of loops for COUNT1 TIME2 EQU 40 ; no. of loops for COUNT2 ; ORG 050H ; via MONITOR RAM COUNT1 DS 1 ; Software COUNTer 1 COUNT2 DS 1 ; COUNTer 2 POST DS 1 ; 1 means 1 sec has lapsed, else 0 ; ORG 4100H START MOV DPTR,#INTT0 ; chain interrupt routine MOV A,#2 MOV COMMAND,#ccLINK LCALL MON MOV TH0,#256-T0valu ; every 250 microseconds MOV TL0,#256-T0valu ; one interrupt from TIMER0 MOV TMOD,#022H ; both COUNTers MODE2 2 MOV COUNT2,#TIME2 ; preset software COUNTer MOV COUNT1,#TIME1 MOV POST,#0 ; no post SETB TCON.4 ; start TIMER0 SETB IE.1 ; switch TIMER0 interrupt on SETB IE.7 ; interrupts on NEW MOV A,#'*' ; send asterisk MOV COMMAND,#ccCHR LCALL MON WAIT MOV A,POST ; wait JZ WAIT ; for POST MOV POST,#0 ; get POST SJMP NEW ; repeat ; INTT0 PUSH PSW ; save PUSH ACC DJNZ COUNT1,IRET1 ; decrement software counter 1 MOV COUNT1,#TIME1 ; reload when 0 is reached DJNZ COUNT2,IRET1 ; and decrement software counter 2 MOV COUNT2,#TIME2 ; reload when 0 is reached MOV POST,#1 ; and leave POST IRET1 POP ACC ; after storage POP PSW RETI ; end of interrupt ; MONITOR INTERFACE COMMAND EQU 030H ; MONITOR command memory location MON EQU 0200H ; MONITOR jump address ccLINK EQU 040H ; Interrupt chaining ccCHR EQU 001H ; send character END |
| Topic | Author | Date |
| 5 Sec delay | 01/01/70 00:00 | |
| RE: 5 Sec delay | 01/01/70 00:00 | |
| RE: 5 Sec delay | 01/01/70 00:00 | |
| RE: 5 Sec delay | 01/01/70 00:00 | |
| RE: 5 Sec delay | 01/01/70 00:00 | |
| RE: 5 Sec delay | 01/01/70 00:00 | |
| RE: 5 Sec delay | 01/01/70 00:00 | |
| RE: 5 Sec delay | 01/01/70 00:00 | |
| RE: 5 Sec delay | 01/01/70 00:00 | |
| RE: 5 Sec delay | 01/01/70 00:00 | |
| RE: 5 Sec delay, Rob, Prasad | 01/01/70 00:00 | |
RE: 5 Sec delay | 01/01/70 00:00 |



