1.24.19.5 RTCC_TimeSet Function

C

bool RTCC_TimeSet(struct tm *Time );

Summary

Sets time and date in the RTCC peripheral.

Description

This functions sets time and date in the RTCC peripheral.

Precondition

The RTCC_Initialize() function should have been called to initialize the RTCC peripheral.

Parameters

Param Description
sys_time Input parameter structure which holds time and date.

Returns

Always return true. Discard the return value at the application level. This return is to satisfy the function signature requirement of drivers which uses different RTC PLIBs.

Example

struct tm sys_time;
//15-01-2018 23:55:52 Monday
sys_time.tm_hour = 23;
sys_time.tm_min = 59;
sys_time.tm_sec = 52;

sys_time.tm_year = 18;
sys_time.tm_mon = 12;
sys_time.tm_mday = 31;
sys_time.tm_wday = 1;

RTCC_TimeSet(&sys_time);

Remarks

This function checks RTCSYNC before writing into RTCTIME and RTCDATE registers. Thus no separate check for the bit is needed.