cancel
Showing results for 
Search instead for 
Did you mean: 

PSoC™ 4

moshc_4060821
New Contributor II

Hello

I am using psoc4 BLE pioneer kit.

I want to generate periodic ISR using RTC after every 24 hour.

Please guide me.

thanks

MOHIT

0 Likes
1 Solution
moshc_4060821
New Contributor II

i have solve the problem.

thank you all for hellping.

here is my code.

int main()

{

    RTC_DATE_TIME alarm_time ;

    uint32_t sec, min, hour ;

    char str[128] ;

 

    init_hardware() ;

 

    sprintf(str, "RTC Alarm Test (%s %s)\n", __DATE__, __TIME__) ;

    UART_PutString(str) ;

    RTC_ClearAlarmStatus() ;

    RTC_SetAlarmHandler( alarm_handler ) ;

    RTC_SetAlarmMask( RTC_ALARM_SEC_MASK ) ; /* I only care for sec this time */

   //*for 24 hr alarm*/RTC_SetAlarmMask(RTC_ALARM_HOUR_MASK | RTC_ALARM_MIN_MASK | RTC_ALARM_SEC_MASK ) ;   

  /*  RTC_GetDateAndTime(&alarm_time) ;

 

    /* create 00:00:15 as alarm_time */

    hour = 0u ;

    min = 0u ;

   sec = 45u ;

    alarm_time.time =

        (uint32_t)(hour <<   RTC_HOURS_OFFSET) |

        (uint32_t)(min  << RTC_MINUTES_OFFSET) |

        (uint32_t)(sec) ;

     

    RTC_SetAlarmDateAndTime( &alarm_time ) ; */

RTC_DATE_TIME MyAlarm;

    RTC_DATE_TIME testReadback;   

   

    

    MyAlarm.time = RTC_SetHours( MyAlarm.time, 0 );

    MyAlarm.time = RTC_SetMinutes( MyAlarm.time, 0 );

    MyAlarm.time = RTC_SetSecond( MyAlarm.time, 45 );

    // Set the Alarm

    RTC_SetAlarmDateAndTime( &MyAlarm );

    while(1)

    {

        if (alarm_flag) {

            alarm_flag = 0 ;

            UART_PutString("ALARM! ") ;

            print_time() ;

        }

        CyDelay(200) ;

    }

}

thank you

mohit

View solution in original post

5 Replies