RTC

Top 

RTC


Embedded Real Time Clock.

Since R2019b

 

Library: embeddedCreatorLib ( Dafulai Electronics) / RTC

 

 

RTC

 

 


 

Description


 

This block will output system clock including year/month/day/week.

 

Parameters


 

Please double click this block to open parameters dialog below:

 

RTC_paramete

 

 

 

 

Let us explain parameters.

 

 

Set Clock initial Value from parameters when Power on — logical scalar. Usually RTC has dedicated small "Coin battery". When micro-controller power off, RTC can stall run by this small "coin battery". So you don't need to initialize RTC's "Year/Month/.../Sec" when micro-controller power on again.   This parameter value "True" means that micro-controller will initialize RTC's "Year/Month/.../Sec" from parameters when micro-controller power on. "False" means that micro-controller will not initialize RTC's "Year/Month/.../Sec" when micro-controller power on.

 

Year — drop list from 2024 to 2055 . You just choose from drop list. This is initial year,  When micro-controller power on or reset, it will take this year as initial value if parameter "Set Clock initial Value from parameters when Power on" is true.

 

Month — drop list from 1 to 12 . You just choose from drop list. This is initial month,  When micro-controller power on or reset, it will take this month as initial value if parameter "Set Clock initial Value from parameters when Power on" is true.

 

Day — drop list from 1 to  31 or 30 or 29 or 28. You just choose from drop list. This is initial day,  When micro-controller power on or reset, it will take this day as initial value if parameter "Set Clock initial Value from parameters when Power on" is true.

 

Week — drop list from "Sunday" To "Saturday". You just choose from drop list. This is initial week,  When micro-controller power on or reset, it will take this value as initial week if parameter "Set Clock initial Value from parameters when Power on" is true.

 

Hour — drop list from 0 to 23. You just choose from drop list. This is initial hour,  When micro-controller power on or reset, it will take this value as initial hour if parameter "Set Clock initial Value from parameters when Power on" is true.

 

Minutes —  integer from 0 to 59. This is initial minutes,  When micro-controller power on or reset, it will take this value as initial minute if parameter "Set Clock initial Value from parameters when Power on" is true.

 

Seconds  — integer from 0 to 59. This is initial seconds,  When micro-controller power on or reset, it will take this value as initial second if parameter "Set Clock initial Value from parameters when Power on" is true.

 

Sample time in sec (-1 for inherited): — Sample time for this block. It is the same meaning as general Simulink block .

 

Notes: Please configure RTCC.   All settings must be done  in IDE GUI configuration (It is MCC for Microchip Micro-controller)

 

Ports


 

Input

 

En — "logical" data type's scalar. True means "RTC" keeps running and updating output port "Yr/Mon/D/.../Sec" continuously.  False means "RTC" stop updating output port "Yr/Mon/D/.../Sec" and set initial values to input port "Yr/Mon/D/.../Sec" if it is connected or set initial values to parameters "Year/Month/.../Seconds" if related input port is not connected.

 

Yr — "unsigned 16 bits of integer" data type's scalar. It denotes initial value of "Year". If input port "En" is false, "RTC" will take this initial value.

 

Mon — "unsigned 8 bits of integer" data type's scalar from 1 to 12. It denotes initial value of "Month". If input port "En" is false, "RTC" will take this initial value.

 

D — "unsigned 8 bits of integer" data type's scalar from 1 to 31. It denotes initial value of "Day". If input port "En" is false, "RTC" will take this initial value.

 

W — "unsigned 8 bits of integer" data type's scalar from 0 to 6. It denotes initial value of "Week" (0 is Sunday,1 is Monday) . If input port "En" is false, "RTC" will take this initial value.

 

Hr — "unsigned 8 bits of integer" data type's scalar from 0 to 59. It denotes initial value of "Hours". If input port "En" is false, "RTC" will take this initial value.

 

Min — "unsigned 8 bits of integer" data type's scalar from 0 to 59. It denotes initial value of "Minutes". If input port "En" is false, "RTC" will take this initial value.

 

Sec — "unsigned 8 bits of integer" data type's scalar from 0 to 59. It denotes initial value of "Seconds". If input port "En" is false, "RTC" will take this initial value.

 

 

Outport


 

Yr — "unsigned 16 bits of integer" data type's scalar. It denotes current value of "Year". If input port "En" is true.

 

Mon — "unsigned 8 bits of integer" data type's scalar. It denotes current value of "Month". If input port "En" is true.

 

D — "unsigned 8 bits of integer" data type's scalar.  It denotes current value of "Day". If input port "En" is true.

 

W — "unsigned 8 bits of integer" data type's scalar. It denotes current value of "Week" (0 is Sunday,1 is Monday) . If input port "En" is true.

 

Hr — "unsigned 8 bits of integer" data type's scalar. It denotes current value of "Hours". If input port "En" is true.

 

Min — "unsigned 8 bits of integer" data type's scalar. It denotes current value of "Minutes". If input port "En" is true.

 

Sec — "unsigned 8 bits of integer" data type's scalar. It denotes current value of "Seconds". If input port "En" is true.

 

 

Examples