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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
12/09/09 11:03
Read: times


 
#171523 - what You are trying to make ?
Responding to: ???'s previous message

Please, deskribe Your target.
Also:

1)
"one LEDs which is driven using P1.1 gets complimented everytime TF2 flag is raised"
I'm not sure - i think toggling led (in Display) causes TF2 to set.

2)You are talking about "capture mode" , but maybe You want Timer2 in timer mode?

mov T2CON,#0
mov T2MOD,#4

3)In subroutine "INPUT:" You change R2 (at least), but this is inside ISR,
You must preserve R2 and any other registers at ISR entering and restore bjust before RETI (or use register bank switching trough PSW) . Also PSW MUST!!! be preserved!!!
4)On 0x2b write only LJMP to Timer2ISR,


   ORG 002BH       ; INTERRUPT SERVICE ROUTINE FOR T2
   LJMP ISR_T2


;...... somewhere
ISR_T2:         push psw
                DJNZ CTR, EXIT  ; DECREMENT COUNTER, EXIT IF NOT ZERO
		ACALL INPUTS    ; ELSE CALL INPUTS SUBROUTINE
		MOV CTR, #0AH   ; RESET COUNTER TO 0Ah
EXIT:		CLR EXF2        ; (CLR EXF2 => T2CON.6)
                pop psw
		RETI            ; RETURN FROM INTERRUPT




 


regards

List of 19 messages in thread
TopicAuthorDate
Problem using Timer2 in 89S52!            01/01/70 00:00      
   not a very useful suggestion from 'Plz'            01/01/70 00:00      
      further suggestion            01/01/70 00:00      
         Message & Readable code is here...            01/01/70 00:00      
            look in the assembler manual            01/01/70 00:00      
               New Code, hope it helps!            01/01/70 00:00      
                  what You are trying to make ?            01/01/70 00:00      
                     mov T2MOD,#4            01/01/70 00:00      
                        sorry            01/01/70 00:00      
                            t2mod=0 ; t2con=4 (tr2=1) It worked!            01/01/70 00:00      
                        PSW            01/01/70 00:00      
                  that is not a comment!            01/01/70 00:00      
                     Comments OR Explaination!!!            01/01/70 00:00      
                        Comments are mainly for YOU            01/01/70 00:00      
                        WRONG!            01/01/70 00:00      
                           Answer the "why" in your comments.            01/01/70 00:00      
                              I got (I)T2 working !!!            01/01/70 00:00      
                  Clear TF2 in your service routine            01/01/70 00:00      
                     Clearing TF2 in ISR            01/01/70 00:00      

Back to Subject List