We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Morning,
I have some stupid troubles with my SAB80C535 µP. I'm trying to read a acceleration sensor (ADXL202JE) with timer 1 and 2. It works aproximatily fine, excepting the "turbulent" resolution, when the timers work separately. But when i put the two timers together in the main programm then all is messed up. The equation is all disturbed and i get astronomical numbers close to ininit or zero. Can it be posible that the timer 1 and 2 cant work together or are there any priority confuses?? Its driving me crazy !!!!!
Thanks for any answer....
Interrupt 10 is for the CC0 unit of timer 2 and is triggered at falling edge. In the main program i first wait for the rising edge and then start the timer and then the interrupt ocurs at the next rising edge. Thats how i messure the pulswidth of one period.
Interrupt 11 is for the CC1 unit of the timer 2 and is trigered at rising edge and it is used to messure the time of one period.
anyhow, as stated before and now with a specific example if T2 interrupts and, one instruction cycle later T1 interrupts, you will get a misread on T1 of something like 40 counts (I can not give anything accurate based on C source). Could that be what you are seing?
Erik
The first timer that starts is the Timer 1:
while (test_Y == 0) { IE1 = 0; TMOD = TMOD | 0x90; TR1 = 1; EX1 = 1; }
The while statement is there so the program can't change to anouther while statement. It waits till the interrupt of timer1 is over and then goes to the next statement. I dont know if this is the problem. Because even if i put timer 1 first or second it doesn't matter, the reaction is the same. What i am seeing on the Timer 1 register is 0. That meens he doesent start o something like that. How could that be?
Just to see, Y would try
{ IE1 = 0; TMOD = TMOD & 0x0f; TMOD = TMOD | 0x90; TR1 = 1; EX1 = 1; }