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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
03/29/10 16:32
Read: times


 
#174597 - Timer Problem Assembly Code
Hey,
So i writing ode involving lightgates and measuring and printing time on a lcd, have two lightgates set up using interupts...ive run throught the code step by step using aspire, but it alwats gets stuck on this line, and wont move into the overflow handler:

jnb finished,$ 		;wait for complete event to finish
 


Interupts are set up as follows:

CSEG			;Interupts
ORG 0000h
       	JMP    MAIN   ;jump to main


org 0003h
      	jmp 	LightGate1		

org 000BH
	jmp	Timer
	

org 0013H
	jmp 	LightGate2

ORG 001Bh
	jmp 	OverflowHandler

 




And this is the timer part of my code:

LightGate1:
	inc counter
	CALL Count_bcd
	setb TR0 	;start event timer
	

reti

Timer:
	mov TH0,#220		; prepare timer registers
	mov TL0, #01
	mov TMOD,#01H 		;Timer 0 mode 1
	clr TF0 		;clear timer interrupt flag
	mov timerOverFlow,#0 	;clear overflow counter
	setb EX0 		;enable external interrupt 0
	setb ET0 		;enable timer interrupt 0
	setb EX1 		;enable external interrupt 1
	setb EA 		;enable global interrupt
	jnb finished,$ 		;wait for complete event to finish
	clr finished 		;clear event bit
	sjmp Timer 		;prepare for next event




LightGate2:
	clr TR0 ;stop event timer
	setb finished ;event finished (finished is defined in 0h) 
reti

OverflowHandler:	;over flow has occurred  (every 1/100 of a second)
	CLR TR0
	inc timeroverflow ;increment overflow counter
	mov atime4, timeroverflow
	Call times_bcd
	Call get_atime5
	CALL Print_atime 
	mov TH0,#220; prepare timer registers
	mov TL0, #01
	setb tr0
	clr TF0 ;clear interrupt flag
reti


 




Anybody have any ideas?






List of 16 messages in thread
TopicAuthorDate
Timer Problem Assembly Code            01/01/70 00:00      
   Interrupt priorities...            01/01/70 00:00      
      Also...            01/01/70 00:00      
      The missing words            01/01/70 00:00      
         You sure?            01/01/70 00:00      
            many ways to skin a cat            01/01/70 00:00      
               Actually very relevant            01/01/70 00:00      
                  My impression is            01/01/70 00:00      
         Interesting, but missing the point surely...            01/01/70 00:00      
            Interrupts are 'saved'            01/01/70 00:00      
               Soft interrupts            01/01/70 00:00      
                  in a '51 forum            01/01/70 00:00      
               Still missing the point...            01/01/70 00:00      
                  the missing reti's have already been mentioned            01/01/70 00:00      
                     Apart from missing reti...            01/01/70 00:00      
   Interupt priorities            01/01/70 00:00      

Back to Subject List