FT90x RTC Interrupt

General discussion on mikroC PRO for FT90x.
Post Reply
Author
Message
molto999
Posts: 4
Joined: 27 Aug 2011 21:29

FT90x RTC Interrupt

#1 Post by molto999 » 21 Jan 2019 13:20

Hi everyone,

After hours seeking info and testing FT90x RTC Interrupt, I finally managed to make it work!!!
The point is to read the RTC_EOI_CONST_BIT register inside the interrupt to reset it properly...
Here is how to do it with a 1 second (RTC_CMR set to 32 !?!) interrupt:

Code: Select all

char RTC_int = 0; // Interrupt occurs

// -----------------------------------------------------------------------------
void RTC_Interrupt() iv IVT_RTC_IRQ ics ICS_AUTO {
  if (RTC_EOI_CONST_BIT == 0) RTC_int = 1;
}
// -----------------------------------------------------------------------------

void Main() {

  RTC_WEN_bit = 1;    // Wrap enabled
  RTC_MASK_bit = 0;   // Interrupt masked
  RTC_CMR = 32;        // Counter Match Register
  RTC_CLR = 0;
  RTC_IEN_bit = 1;    // Interrupt enabled
  RTC_EN_bit = 1;     // Counter enabled

  GLOBAL_INTERRUPT_MASK_bit = 0;

  while (1) {
    
    if (RTC_int) {
      // your code here, triggered every second
      RTC_int = 0;
    }
}

Enjoy!
molto999 8)

User avatar
petar.suknjaja
mikroElektronika team
Posts: 683
Joined: 05 Mar 2018 09:44
Location: Belgrade

Re: FT90x RTC Interrupt

#2 Post by petar.suknjaja » 22 Jan 2019 12:10

Hi molto999,
Thank you for your contribution,
I'll check this out.
Kind regards,
Petar

Post Reply

Return to “mikroC PRO for FT90x General”