Hello,
I am trying to run a simple program to test the 32 MHz timer. (Clock speed set to 250 KHz and tick speed set to 32 MHz, clock running in free run mode).
Below is the code entered into IAR Embedded Workbench:
#include<ioCC2530.h>
int a = 0;
int c = 0;
#pragma vector=T1_VECTOR //The interrupt never occurs
__interrupt void TIMER1_IRQ()
{
a = 1;
T1CTL = 0X00;
T1CTL = 0X0D;
c = 2;
}
main()
{
T1IE = 1; //Timer 1 interrupt enable
T1OVFIM = 1; //Timer 1 overflow interrupt mask set
CLKCONCMD = 0x07; //32 MHz XOSC chosen with clock speed 250 MHz
T1CTL = 0x0D; //Prescaler set to 128 and mode is free-run
while(1);
}
Is the above program correct? I expected the interrupt to triggered after 33 seconds but the flags T1STAT.OVFIF and IRCON.T1IF are not being set indicating that the timer isn’t working. How shall we fix this? Also, what is the difference between clock speed and tick speed?
Thank you
SIDDHARTH