FT900 Global Interrupts

General discussion on mikroC PRO for FT90x.
Post Reply
Author
Message
PPK
Posts: 18
Joined: 08 Jan 2018 06:27

FT900 Global Interrupts

#1 Post by PPK » 06 Mar 2018 12:22

Hi,
I'm trying to make a 10mS timing interrupt for general application timers.
It would appear that the Interrupt is not firing after I have called InitSystemTimerA().
Do Global Interrupts need to be enabled?

Code: Select all

void TimerInterrupt() iv IVT_TIMERS_IRQ{
  if(WD_Timer>0) --WD_Timer;
  if(ScreenTimer>0) --ScreenTimer;
  if(RxMessTimer>0) --RxMessTimer;
  if(HIDCommsWDTimer>0) --HIDCommsWDTimer ;
}

#ifdef Timer_10mS
//TimerA Prescaler = 62500 Preload = 15 Actual Interrupt Time = 10 ms
void InitSystemTimerA() {
  TIMER_CONTROL_0 = 2;
  TIMER_SELECT = 0;
  TIMER_PRESC_LS = 36;
  TIMER_PRESC_MS = 244;
  TIMER_WRITE_LS = 15;
  TIMER_WRITE_MS = 0;
  TIMER_CONTROL_3 = 0;
  TIMER_CONTROL_4 |= 17;
  TIMER_CONTROL_2 |= 16;
  TIMER_INT |= 2;
  TIMER_CONTROL_1 |= 1;
}
#endif
I copied and pasted the below code from the Interrupt Example in the help file.
The compiler is having issues with the below line
// Enable global interrupts
FT900_INTR_CTRL.B31 = 0;

It would appear that FT900_INTR_CTRL has not been defined anywhere.
"Undeclared identifier 'FT900_INTR_CTRL' in expression"

What is the correct way to Enable Global Interrupts?

Thanks,
Neil.

Code: Select all

volatile char val;// Timer interrupt function
void Timer_Interrupt() iv IVT_TIMERS_IRQ{  // Toggle led value  val = ~val;
  GPIO_PIN60_bit = val;  GPIO_PIN17_bit = val;  // Clear Timer A interrupt
  TIMER_INT.B0 = 1;}void main() {  // Initialize LD1 as digital output
  GPIO_Pin_Digital_Output(_GPIO_PIN_NUM_60);
  // Initialize LD2 as digital output
  GPIO_Pin_Digital_Output(_GPIO_PIN_NUM_17);  GPIO_PIN60_bit = 0;
  GPIO_PIN17_bit = 0;  val = 0;  // Enable the Timer module
  TIMER_CONTROL_0 = 2;  // Select Timer A  TIMER_SELECT = 0;
  // Write prescaler for Timer A  TIMER_PRESC_LS = 10000;
  TIMER_PRESC_MS = 10000 >> 8;  // Write start value  TIMER_WRITE_LS = 10000;
  TIMER_WRITE_MS = 10000 >> 8;    // Set continuous mode and direction down
  TIMER_CONTROL_3 = 0;    // Trigger clearing timer A and prescaler
  TIMER_CONTROL_4 = 0x11;    // Enable prescaler for Timer A
  TIMER_CONTROL_2 = 0x10;  // Enable Timer A interrupt  TIMER_INT.B1 = 1;
  // Enable global interrupts  FT900_INTR_CTRL.B31 = 0;  // Start timer A
  TIMER_CONTROL_1 = 1;  while(1)    ;}

Niope
Posts: 2
Joined: 27 Jul 2017 14:49

Re: FT900 Global Interrupts

#2 Post by Niope » 07 Mar 2018 11:22

Hi Nell,

the correct name of the register for enable global interrupts is this: IRQ_CTRL.
You have to reset bit31.

Regards
Giordano

Post Reply

Return to “mikroC PRO for FT90x General”