R_RTC_Set_CounterValue


Sets the counter value (year, month, weekday, day, hour, minute, second) of the real-time clock.

[Syntax]

#include    "r_cg_macrodriver.h"
#include    "r_cg_rtc.h"
MD_STATUS   R_RTC_Set_CounterValue ( rtc_counter_value_t counter_write_val );

[Argument(s)]

I/O

Argument

Description

I

rtc_counter_value_t
  counter_write_val;

Counter value

Remark

Below is an example of the structure rtc_counter_value_t (counter value) for the real-time clock.

typedef struct {
    uint8_t sec;    /* Second */
    uint8_t min;    /* Minute */
    uint8_t hour;   /* Hour */
    uint8_t day;    /* Day */
    uint8_t week;   /* Weekday (0: Sunday, 6: Saturday) */
    uint8_t month;  /* Month */
    uint16_t year;  /* Year */
} rtc_counter_value_t;

[Return value]

Macro

Description

MD_OK

Normal completion

MD_BUSY1

Executing count process (before change to setting)

MD_BUSY2

Stopping count process (after change to setting)

Remark

If MD_BUSY1 or MD_BUSY2 is returned, it may be because the counter-operation is stopped, or the counter operation start wait time is too short, so make the value of the RTC_WAITTIME macro defined in the header file "r_cg_rtc.h" larger.