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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
07/01/01 04:24
Read: times


 
#12924 - Using timers 0&1 problem
Hi!
I have a problem using timers 0 & 1. I can not find mistake. Here is my code (main part):

;interrupt\'s vectors table
ORG 0
AJMP Init
ORG 3
AJMP IntExt0
ORG 13H
AJMP IntExt1

ORG 30H
IntExt0: SETB TR0
SETB TR1
SETB falling
RETI

IntExt1: CLR TR0
CLR TR1
SETB rising
RETI

;main program
Init: MOV IE,#5 ;enable only ex1 & ex0
MOV TCON,#5 ;int.0&1 are falling edge sensitive
MOV TMOD,#11H ;both timers are in 16-bit \"software controlled timer\" mode
;here my program is initializing lcd display and ports values
Loop: ACALL Measure
MOV R5,#0
MOV R6,TH1
MOV R7,TL1
ACALL Display ;routine is converting and displaying the content of r5..r7
MOV R5,#0
MOV R6,TH0
MOV R7,TL0
ACALL Display ;the same for timer 0
ACALL Pause
AJMP Loop

Measure: CLR rising
CLR falling
MOV TL0,#0
MOV TH0,#0
MOV TL1,#0
MOV TH1,#0
SETB EA
JNB falling,$
JNB rising,$
CLR EA
RET

I have been using both timers in mode 1 (I hope...). The timers are starting at the same time (interrupt routine 1) and will stop at the same time (int.routine 0). I put clock signal at int1 pin directly, at int0 pin via inverter.
Timer 0 counting result is 20, timer 1 counting result is 1435. Why???
I\'ve been using AT89S8252 unit, clock signal is from clock signal generator via 74hct14 (clock -> int1 -> 74hct14 -> int0). I have checked pins 12 & 13 of AT micro by oscilloscope - signal looks very good (the phases are diffrent at both pins). Oscillator is 11.0592MHz (1.085us machine cycle), clock signal frequency is about 2kHz.

List of 7 messages in thread
TopicAuthorDate
Using timers 0&1 problem            01/01/70 00:00      
RE: Using timers 0&1 problem            01/01/70 00:00      
RE: Using timers 0&1 problem            01/01/70 00:00      
RE: Using timers 0&1 problem            01/01/70 00:00      
RE: Using timers 0&1 problem            01/01/70 00:00      
RE: Using timers 0&1 problem            01/01/70 00:00      
RE: Using timers 0&1 problem            01/01/70 00:00      

Back to Subject List