Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
03/13/09 05:16
Read: times


 
#163401 - Interrupts and timers
Hi. Well, my problem right now is that I have been working more and more with the 8051, but I have found a dead-end. I learned how to program the timers and how to make them work, but now, I want to activate the timer using an external interrupt, but my program doesn't runs correctly, even though I made it from my timer one. I think I'm declaring incorrectly the interrupt or the function of the interrupt. If someone could lend me a hand and check it, I'll really appreciate any recommendation right now.

Here is the code of my program.


.equ    port_e, 0xF901
.equ	port_def_pgm, 0xF903
.equ	alarm, 0x00
.equ	count, 0x40
   
.org 2000h
ljmp main
      
.org 200Bh
ex0_isr:
	push	acc
	push	dph
	push	dpl
	mov	count, #250
	setb 	tr0
	jnb	alarm, *
	pop	dpl
	pop	dph
	pop	acc
	reti
t0_isr:
	mov	th0,#0x00
	mov	tl0,#0x00
	mov	a, count
	movx	@dptr, a
	djnz 	count, t0_end
	setb	alarm
t0_end:
	reti
     
main:
	mov	dptr, #port_def_pgm
	mov	a, #128
	movx	@dptr, a

	mov     dptr, #port_e
        mov     a, #0xFF
        movx    @dptr, a

	mov	tmod,#0x01

	clr	tr0
	clr	tf0
	mov	th0,#0x00
	mov	tl0,#0x00

	setb	ex0
	setb	et0
	setb	ea   
	setb	it0
	mov	ip, #0  
	mov	a, #0

loop:
	movx	@dptr, a
	inc	a
	ljmp	loop
 


List of 5 messages in thread
TopicAuthorDate
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      

Back to Subject List