Jump to content

Component: Real Time Clock (Internal, DS1307, DS3231, DS3232) (Real Time Clock)

From Flowcode Help
Author Matrix TSL
Version 2.2
Category Real Time Clock


Real Time Clock (Internal, DS1307, DS3231, DS3232) component

A Real Time Clock component allowing things like clocks and timers to easily be created. Compatible with the internal RTCC module and external DS1307, DS3231 or DS3232 RTC ICs.

Detailed description

No detailed description exists yet for this component

Examples

Example showing how to retrieve and display the time using bytes or string with the RTC component.

RTC DS1307 DS3231 example

Macro reference

GetAmPm

GetAmPm
Checks to see if the time is currently AM or PM for 12 hour clock mode. Simulation returns system time. 0 = AM / 1 = PM 
- BYTE WhichClock
0=Time, 1=Alarm1 DS3231, 2=Alarm2 DS3231 
- BYTE Return


GetDate

GetDate
Gets the date as a binary value 1-31. Simulation returns system date. 
- BYTE Return


GetDateString

GetDateString
Reads the current date from the RTC and returns it formatted as a string. e.g. DD:MM:YY 
- BYTE USformat
0="DD/MM/YY", 1="MM/DD/YY" 
- STRING Return


GetHours

GetHours
Gets the hours of the current time as a binary value 0-11 or 0-23. Simulation returns system time. 
- BYTE WhichClock
0=Time, 1=Alarm1 DS3231, 2=Alarm2 DS3231 
- BYTE Return


GetMins

GetMins
Gets the minutes of the current time as a binary value 0-59. Simulation returns system time. 
- BYTE WhichClock
0=Time, 1=Alarm1 DS3231, 2=Alarm2 DS3231 
- BYTE Return


GetMonth

GetMonth
Gets the month as a binary value 1-12. Simulation returns system date. 
- BYTE Return


GetRamDS1307

GetRamDS1307
Gets a byte of RAM from the free memory on the DS1307 device. 
- BYTE Address
56 RAM Locations. Range: 0 to 55 
- BYTE Return


GetRamDS3232

GetRamDS3232
Gets a byte of RAM from the free memory on the DS3232 device. 
- BYTE Address
236 RAM Locations. Range: 0 to 235 
- BYTE Return


GetSecs

GetSecs
Gets the seconds of the current time as a binary value 0-59. Simulation returns system time. 
- BYTE WhichClock
0=Time, 1=Alarm1 DS3231 
- BYTE Return


GetTimeString

GetTimeString
Reads the current time from the RTC and returns it formatted as a string. e.g. HH:MM:SS 
- BYTE IncludeSeconds
0=Dont Include Seconds, 1=Include Seconds 
- STRING Return


GetWeekDay

GetWeekDay
Gets the day of the week as a binary value 1-7. This function doesn't currently simulate. 
- BYTE WhichClock
0=Time, 1=Alarm1 DS3231, 2=Alarm2 DS3231 
- BYTE Return


GetYear

GetYear
Gets the year as a binary value 0-99. Simulation returns system date. 
- BYTE Return


Initialise

Initialise
Initialises the RTC component ready for operation. 
- VOID Return


SQWandINTcontrol

SQWandINTcontrol
Allows a square wave output to be generated by the DS1307 and DS3231 ICs. Also allows the DS3231 interrupts to be configured via the INT/SQW pin. This function doesn't currently simulate. 
- BYTE SquareWaveEnable
0 = Square Wave Output Disabled / 1 = Square Wave Output Enabled 
- BYTE FrequencySelect
Controls the output frequency of the square wave, Range 0-3, Refer to the device datasheet for frequencies 
- BYTE InterruptEnable
Only Available on DS3231 and when SQW is disabled. Range 0-3 
- VOID Return


SetDate

SetDate
Sets the date as a binary value 1-31. Does not currently simulate. 
- BYTE date
Range 1-31 
- VOID Return


SetHours

SetHours
Sets the hours as a binary value 0-23. Does not currently simulate. 
- BYTE Hours
Range 0-23 
- BYTE Mode
0=24 Hour Clock, 1=12 Hour Clock 
- BYTE WhichClock
0=Time, 1=Alarm1 DS3231, 2=Alarm2 DS3231 
- VOID Return


SetMins

SetMins
Sets the minutes as a binary value 0-59. Does not currently simulate. 
- BYTE Minutes
Range 0-59 
- BYTE WhichClock
0=Time, 1=Alarm1 DS3231, 2=Alarm2 DS3231 
- VOID Return


SetMonth

SetMonth
Sets the month as a binary value 1-12. Does not currently simulate. 
- BYTE month
Range 1-12 
- VOID Return


SetRamDS1307

SetRamDS1307
Sets the value of one of the free RAM locations on the DS1307 device 
- BYTE Address
56 RAM Locations. Range: 0 to 55 
- BYTE Data
Data value. Range 0 to 255 
- VOID Return


SetRamDS3232

SetRamDS3232
Sets the value of one of the free RAM locations on the DS3232 device 
- BYTE Address
236 RAM Locations. Range: 0 to 235 
- BYTE Data
Data value. Range 0 to 255 
- VOID Return


SetSecs

SetSecs
Sets the seconds as a binary value 0-59. Does not currently simulate. 
- BYTE Seconds
Range 0-59 
- BYTE WhichClock
0=Time, 1=Alarm1 DS3231 
- VOID Return


SetWeekDay

SetWeekDay
Sets the day of the week as a binary value 1-7. This function doesn't currently simulate. 
- BYTE Day
Range 1-7 
- BYTE WhichClock
0=Time, 1=Alarm1 DS3231, 2=Alarm2 DS3231 
- VOID Return


SetYear

SetYear
Sets the year as a binary value 0-99. Does not currently simulate. 
- BYTE year
Range 0-99 
- VOID Return


Property reference

Properties
RTC Module
 
I2C Address
 
Connections
Channel
Channel selection 
SDA
Pin used for SDA (data signal) 
SCL
Pin used for SCL (clock signal) 
Baud Select
Baud rate option selector 
Baud Rate
Baud rate to be used 
Stop Delay
On older microcontroller devices there is a potential for the I2C hardware channel to lock up if there is not a 10ms delay between an I2C stop event and the next I2C start event. Most modern microcontrollers will not have a problem so this property can be disabled to speed up the I2C communications.  
Simulation
Simulate Comms
 
Simulation
Scope Traces
Selects if the component pin connections are automatically generated on the data recorder window or not. Yes: Automatically add the component pins to a group on the data recorder which will reflect the sim data during simultion. No: Do not show the pin signals on the data recorder window. 
Console Data
Selects if the console data is automatically generated or not 
API
Specifies the injector component on the panel to interact with to provide comms simulation. 

Component Source Code

Please click here to download the component source project: FC_Comp_Source_RealTimeClock.fcfx

Please click here to view the component source code (Beta): FC_Comp_Source_RealTimeClock.fcfx