Timer0 Match Interrupt

basically miscellaneous, if it doesn't fit another sub-forum enter it here, we might even promote it to its own sub-forum
Post Reply
danlee58
Posts: 210
Joined: Thu Jan 17, 2013 2:29 am

Timer0 Match Interrupt

Post by danlee58 »

I have a SuperPro. I have set up Timer0 to Interrupt on Match 0xFFFFFF. This takes a few seconds after a reset for the Interrupt procedure to run and print some text to the terminal. Once the procedure begins to run, it will run continuously. I expect it to take a few more seconds to Match 0xFFFFFF again.

This is the code to reset Timer0.

T0_TCR = 2; //Reset Timer 0
T0_TCR = 1; //Enable Timer 0



olzeke51
Posts: 414
Joined: Sat May 17, 2014 4:22 pm
Location: South Carolina

Re: Timer0 Match Interrupt

Post by olzeke51 »

there was some timer changes recently - Apr???
http://www.coridiumcorp.com/forum/viewt ... tick#p2471
is my search -- check your kernel versions/dates
'
what is your clock source/freq for the Timer0??
'
are you getting the first INT message but not the 2nd??

danlee58
Posts: 210
Joined: Thu Jan 17, 2013 2:29 am

Re: Timer0 Match Interrupt

Post by danlee58 »

The clock source is PCLK. I have Timer0 clocking at full rate (Prescale = 0). I get the first interrupt message, but then it seems to repeat, as if Timer0 interrupt was not cleared or the timer was not reset.

There should be dead time between messages. It's to be used as a watchdog timer to keep another operation from rollover.

danlee58
Posts: 210
Joined: Thu Jan 17, 2013 2:29 am

Re: Timer0 Match Interrupt

Post by danlee58 »

I think that it's working now. I used this code:

T0_IR = 0x1; //Reset Channel 0 Interrupt.
T0_TCR = 2; //Reset Timer 0
T0_TCR = 1; //Enable Timer 0

However, I don't get a message from the Main Program in between the Timer0 Interrupt messages.

basicchip
Posts: 1090
Joined: Fri Oct 19, 2012 2:39 am
Location: Weeki Watchee, FL
Contact:

Re: Timer0 Match Interrupt

Post by basicchip »

Take a look at the TIMER1 interrupt example in BASIC, same general operations have to be done

Code: Select all


INTERRUPT SUB TIMER1IRQ
  T1_IR = 1	      ' Clear interrupt
ENDSUB

SUB ON_TIMER ( msec, dothis )
   TIMER1_ISR   = dothis + 1              'in C you don't need to do this if the vector already points to dothis
   VICIntEnable or= (1<<2)  'Enable interrupt
  T1_MR0 = msec-1 ' set up match number of ms
  T1_MCR = 3      ' Interrupt and Reset on MR0
  T1_IR  = 1      ' clear interrupt
  T1_TC  = 0      ' clear timer counter
  T1_TCR = 1      ' TIMER1 Enable
ENDSUB

main:
  ON_TIMER(2000, ADDRESSOF TIMER1IRQ)

danlee58
Posts: 210
Joined: Thu Jan 17, 2013 2:29 am

Re: Timer0 Match Interrupt

Post by danlee58 »

It appears that the Main loop stops executing, once the Timer0 Interrupt runs. Timer0 continues to run, however.

danlee58
Posts: 210
Joined: Thu Jan 17, 2013 2:29 am

Re: Timer0 Match Interrupt

Post by danlee58 »

I caught this message on y Terminal Program;

FaultISR 0xFFFFFFF1 SCB->CFSR=0x00020000

Any idea what this means?

olzeke51
Posts: 414
Joined: Sat May 17, 2014 4:22 pm
Location: South Carolina

Re: Timer0 Match Interrupt

Post by olzeke51 »

this thread might shed some light on it..
http://www.coridiumcorp.com/forum/viewt ... t=244#p628

Post Reply