| ??? 03/20/09 13:54 Read: times |
#163695 - After a week of deep work with it Responding to: ???'s previous message |
I read a little about the workings of the timer, and I realized my problem was that I enabled the timer 0 interrupt, while I just needed to enable the external one, configure the timer and make a loop for the time needed. The header isn't really needed, because Paulmon can access programs with a JUMP function.
Here is the code that worked (the normal loop was from one of PJRC examples) .equ locat, 0x2000
.equ port_e, 0xF901
.equ port_def_pgm, 0xF903
.org locat
lcall start
.org locat + 3
timer0_isr:
push psw
push acc
push dpl
push dph
mov dptr, #port_e
lcall cicle
pop dph
pop dpl
pop acc
pop psw
reti
.org locat + 48
start:
mov dptr, #port_def_pgm
mov a, #128
movx @dptr, a
mov tmod, #0x11
mov ie, #0x81
loop:
clr it0
[...]
;=======================================================
; Timer Configuration
;=======================================================
cicle:
clr tr0
clr tf0
anl tmod, #0xF0
orl tmod, #0x01
mov tl0, #0
mov th0, #0
mov r2, #56
setb tr0
sjmp loop1
loop1:
mov a, #0x55
movx @dptr, a
jnb tf0, loop1
clr tf0
djnz r2, loop1
mov r2, #56
sjmp loop2
loop2:
mov a, #0xAA
movx @dptr, a
jnb tf0, loop2
clr tf0
djnz r2, loop2
mov r2, #56
sjmp loop3
loop3:
mov a, #0x55
movx @dptr, a
jnb tf0, loop3
clr tf0
djnz r2, loop3
mov r2, #56
sjmp loop4
loop4:
mov a, #0xAA
movx @dptr, a
jnb tf0, loop4
clr tf0
djnz r2, loop4
mov r2, #56
sjmp loop5
loop5:
mov a, #0x55
movx @dptr, a
jnb tf0, loop5
clr tf0
djnz r2, loop5
ret
|
| Topic | Author | Date |
| Interrupts and timers | 01/01/70 00:00 | |
| keep interrupts short ... in time .. and more | 01/01/70 00:00 | |
| Thanks about the info | 01/01/70 00:00 | |
| some thoughts | 01/01/70 00:00 | |
After a week of deep work with it | 01/01/70 00:00 |



