|
|
| uint8_t dcf77_sync |
( |
uint8_t |
dcf77_signal, |
|
|
uint8_t |
logic_type, |
|
|
volatile real_time_data * |
real_time, |
|
|
uint8_t |
sample_time, |
|
|
uint8_t |
command |
|
) |
| |
Synchronizes to DCF77 time data and must be called periodically with the given sample time. The sample time should be around 10 ms.
The function has the following return values (which represent it's internal state):
- DCF77_STARTSYNC_SEARCH01: Looking for the first falling edge of the DCF77 input signal. This is a part of the search for the synchronization marker.
- DCF77_STARTSYNC_SEARCH02: Looking for the second falling edge of the DCF77 input signal. This is a part of the search for the synchronization marker.
- DCF77_STARTSYNC_COMPLETED: Synchronization marker was found. If this return value is delivered, the second "01" is now synchronous to the DCF77 time. However this marker should not be used to synchronize the clock, because this may be detected sometimes also as a consequence of noise.
- DCF77_TIMESYNC_SEARCH01: Looking for the falling edge of the signal (start of a pulse) during the receiving of the time data bit stream.
- DCF77_TIMESYNC_SEARCH02: Looking for the raising edge of the signal (end of a pulse) during the receiving of the time data bit stream.
- DCF77_MINUTE_COMPLETED: The time data for the next minute was received completely and thus the respective value of the real_time structure (current_minute) was updated.
- DCF77_HOUR_COMPLETED: The time data for the current hour was received completely and thus the respective value of the real_time structure (current_hour) was updated.
- DCF77_DAY_COMPLETED: The date value for the current day was received completely and thus the respective value of the real_time structure (current_day) was updated.
- DCF77_WEEKDAY_COMPLETED: The value for the current weekday name was received completely and thus the respective value of the real_time structure (current_weekday) was updated.
- DCF77_MONTH_COMPLETED: The date value for the current month was received completely and thus the respective value of the real_time structure (current_month) was updated.
- DCF77_TIMESYNC_COMPLETED: The date value for the current day was received completely and thus the respective value of the real_time structure (current_day) was updated. The synchronization is now complete and the internal clock can be synchonized with the received values (the value for the current second is now 59.
- Parameters
-
| [in] | dcf77_signal | input signal from DCF77 module (Bit 0: 0x00 or 0x01) |
| [in] | logic_type | DCF77_ACTIVE_HIGH: input signal from DCF77 is "active high"
DCF77_ACTIVE_LOW: input signal from DCF77 is "active low" |
| [in] | real_time | structure in which the function writes the real time |
| [in] | sample_time | sample time (DCF77 signal) [ms * 10] |
| [in] | command | command:
DCF77_RESET_TIME: start a new sync cycle
DCF77_GET_TIME: normal operation during sync |
- Returns
- state of synchronization (see definitions for the internal states in file dcf77.h)
- Date
- Created 05.08.2010
- Modified 28.09.2011
- See Also
- dcf77.h
-
port_definitions.h
- Author
- Michael Skutek, micha.nosp@m.el@s.nosp@m.kutek.nosp@m..de
Definition at line 122 of file dcf77.c.
Referenced by ISR(), and main().
|