firmware/dcftime.c File Reference

Decoder for DCF-77 time signals. More...

#include "boole.h"
#include "dcftime.h"

Include dependency graph for dcftime.c:

Go to the source code of this file.

Data Structures

struct  dcf_receiving_data_struct
 format of the received data, filled during reception More...
struct  dcf_data_struct
 format of the DCF data. More...

Typedefs

typedef unsigned int dcf_sample
 number of the current sample
typedef unsigned int dcf_sizetype
 used for the size of a month
typedef enum dcf_logic_signal_enum dcf_logic_signal
 definition of logical signal states
typedef dcf_receiving_data_struct dcf_receiving_data
 definition of the received data, filled during reception

Enumerations

enum  dcf_logic_signal_enum { dcf_signal_no, dcf_signal_false, dcf_signal_true, dcf_signal_invalid }
 definition of logical signal states More...

Functions

void dcf_init (void)
 Initialize the DCF-module.
void dcf_signal (boolean signal)
 Tell the DCF-module if the signal is high or low.
dcf_datetime dcf_current_datetime (void)
 Fetch the current date and time.
const char * dcf_dayofweek_name (dcf_dayofweek dow)
 Get the name of the current weekday.
const char * dcf_is_dst_name (dcf_is_dst dst)
 Get the name of the current daylight saving time (summertime, wintertime).

Variables

const dcf_sample dcf_second_samples = (DCF_RATE)
 number of samples per second
const dcf_sample dcf_logic_false_min = (DCF_RATE)*3/100
 dcf signal between 30ms and 130ms => dcf logic false (lower value)
const dcf_sample dcf_logic_false_max = (DCF_RATE)*13/100
 dcf signal between 30ms and 130ms => dcf logic false (upper value)
const dcf_sample dcf_logic_true_min = (DCF_RATE)*14/100
 dcf signal between 140ms and 230ms => dcf logic true (lower value)
const dcf_sample dcf_logic_true_max = (DCF_RATE)*23/100
 dcf signal between 140ms and 230ms => dcf logic true (upper value)
const dcf_sample dcf_second_tolerance_min = (DCF_RATE) - (DCF_RATE)*3/100
 duration between begin of dcf second (== begin of signal), should be 1 * second +/- 3% (lower value)
const dcf_sample dcf_second_tolerance_max = (DCF_RATE) + (DCF_RATE)*3/100
 duration between begin of dcf second (== begin of signal), should be 1 * second +/- 3% (upper value)


Detailed Description

Decoder for DCF-77 time signals.

Author:
Ronald Schaten & Thomas Stegemann
Version:
Id
dcftime.c,v 1.2 2007/01/03 12:38:55 rschaten Exp
License: See documentation.

Definition in file dcftime.c.


Typedef Documentation

typedef enum dcf_logic_signal_enum dcf_logic_signal

definition of logical signal states

Definition at line 42 of file dcftime.c.

typedef struct dcf_receiving_data_struct dcf_receiving_data

definition of the received data, filled during reception

Definition at line 55 of file dcftime.c.

typedef unsigned int dcf_sample

number of the current sample

Definition at line 17 of file dcftime.c.

typedef unsigned int dcf_sizetype

used for the size of a month

Definition at line 18 of file dcftime.c.


Enumeration Type Documentation

enum dcf_logic_signal_enum

definition of logical signal states

Enumerator:
dcf_signal_no  no signal
dcf_signal_false  'false' signal
dcf_signal_true  'true' signal
dcf_signal_invalid  invalid signal

Definition at line 35 of file dcftime.c.


Function Documentation

dcf_datetime dcf_current_datetime ( void   ) 

Fetch the current date and time.

Returns:
The current date and time in a dcf_datetime structure

Definition at line 407 of file dcftime.c.

References dcf_data_struct::current_datetime, dcf_datetime_struct::has_signal, dcf_receiving_data_struct::is_valid, dcf_data_struct::receiving_data, and dcf_data_struct::use_first_current_datetime.

Referenced by timerInterrupt().

const char* dcf_dayofweek_name ( dcf_dayofweek  dow  ) 

Get the name of the current weekday.

Parameters:
dow Day of the current week. Monday = 1, tuesday = 2...
Returns:
Pointer to the name

Definition at line 417 of file dcftime.c.

void dcf_init ( void   ) 

Initialize the DCF-module.

Call dcf_init before any other DCF function.

Definition at line 350 of file dcftime.c.

References dcf_data_struct::current_datetime, dcf_data_struct::current_datetime_sample, dcf_data_struct::receiving_data, True, and dcf_data_struct::use_first_current_datetime.

Referenced by main().

const char* dcf_is_dst_name ( dcf_is_dst  dst  ) 

Get the name of the current daylight saving time (summertime, wintertime).

Parameters:
dst daylight saving time bit from the time signal
Returns:
Pointer to the name

Definition at line 438 of file dcftime.c.

void dcf_signal ( boolean  signal  ) 

Tell the DCF-module if the signal is high or low.

This function decides if the received bit is a long or a short one, and if it is usable at all. It should be called regularly, the number of calls per second is defined in DCF_RATE.

Parameters:
signal True if the input signal is high, False if it is low.

Definition at line 358 of file dcftime.c.

References dcf_data_struct::current_datetime_sample, dcf_receiving_data_struct::current_signal, dcf_logic_false_max, dcf_logic_false_min, dcf_logic_true_max, dcf_logic_true_min, dcf_second_samples, dcf_signal_false, dcf_signal_invalid, dcf_signal_true, False, dcf_receiving_data_struct::high_samples, dcf_receiving_data_struct::is_valid, dcf_receiving_data_struct::low_samples, dcf_data_struct::receiving_data, dcf_time_struct::second, dcf_receiving_data_struct::time, and True.

Referenced by timerInterrupt().


Variable Documentation

const dcf_sample dcf_logic_false_max = (DCF_RATE)*13/100

dcf signal between 30ms and 130ms => dcf logic false (upper value)

Definition at line 24 of file dcftime.c.

Referenced by dcf_signal().

const dcf_sample dcf_logic_false_min = (DCF_RATE)*3/100

dcf signal between 30ms and 130ms => dcf logic false (lower value)

Definition at line 22 of file dcftime.c.

Referenced by dcf_signal().

const dcf_sample dcf_logic_true_max = (DCF_RATE)*23/100

dcf signal between 140ms and 230ms => dcf logic true (upper value)

Definition at line 28 of file dcftime.c.

Referenced by dcf_signal().

const dcf_sample dcf_logic_true_min = (DCF_RATE)*14/100

dcf signal between 140ms and 230ms => dcf logic true (lower value)

Definition at line 26 of file dcftime.c.

Referenced by dcf_signal().

const dcf_sample dcf_second_samples = (DCF_RATE)

number of samples per second

Definition at line 20 of file dcftime.c.

Referenced by dcf_signal().

const dcf_sample dcf_second_tolerance_max = (DCF_RATE) + (DCF_RATE)*3/100

duration between begin of dcf second (== begin of signal), should be 1 * second +/- 3% (upper value)

Definition at line 32 of file dcftime.c.

const dcf_sample dcf_second_tolerance_min = (DCF_RATE) - (DCF_RATE)*3/100

duration between begin of dcf second (== begin of signal), should be 1 * second +/- 3% (lower value)

Definition at line 30 of file dcftime.c.


Generated on Wed Jan 3 22:22:42 2007 for Binary DCF-77 Clock by  doxygen 1.5.1