Everything

使用例

アラーム割り込みで擬似的に閏秒の補正を行う(特定日の日付変更直前の 59 秒時点で 58 秒に戻す)

 

[GUI設定例]

リアルタイムクロック

RTC

使用する

リアルタイムクロック動作設定

使用する

カウントモード

カレンダ

時間モード

24 時間モード

 

 

 

リアルタイムクロック時刻設定

2000/1/1 23:59

 

 

 

時間キャプチャ設定

使用しない

 

 

 

アラーム割り込み設定

使用する

 

 

 

2000

 

 

 

1

 

 

 

1

 

 

 

曜日

土曜日

 

 

 

23

 

 

 

59

59

 

 

 

優先順位(ALM)

レベル15

周期割り込み設定

使用しない

桁上げ割り込み設定

使用しない

 

 

 

 

[API設定例]

r_cg_main.c

void main(void)

{

       R_MAIN_UserInit();

       /* Start user code. Do not edit comment generated here */

       /* Start RTC counter */

       R_RTC_Start();

 

       while (1U)

       {

              ;

       }

       /* End user code. Do not edit comment generated here */

}

 

r_cg_rtc_user.c

/* Start user code for global. Do not edit comment generated here */

volatile rtc_calendarcounter_value_t counter_val;

/* End user code. Do not edit comment generated here */

 

static void r_rtc_alm_interrupt(void)

{

       /* Start user code. Do not edit comment generated here */

       /* Disable ALM interrupt */

       IEN(RTC,ALM) = 0U;

 

       /* Get RTC calendar counter value */

       R_RTC_Get_CalendarCounterValue((rtc_calendarcounter_value_t *)&counter_val);

 

       /* Change the seconds */

       counter_val.rseccnt = 0x58U;

 

       /* Set RTC calendar counter value */

       R_RTC_Set_CalendarCounterValue(counter_val);

       /* End user code. Do not edit comment generated here */

}