1.10.20.5 1.11.20.5 1.12.21.5 1.13.19.5 1.14.14.5 1.15.15.5 1.16.21.5 1.17.17.5 1.18.17.5 1.19.17.5 1.20.21.5 1.21.22.5 1.22.23.5 1.23.22.5 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.