DCF77_TIME_EX

DCF77_TIME_EX 1:

The "DCF77_TIME_EX" function block can be used to decode the DCF-77 radio clock signal. In contrast to the DCF77_TIME function block, this block checks two consecutive telegrams for plausibility as standard.

A rising edge at the RUN input starts the decoding process, which continues as long as the RUN input remains set. In the worst case synchronisation of the function block takes up to one minute and two further minutes for decoding data for the next minute. It is waiting, during that time, for the missing 59th second marker. Internally the function block is sampling the DCF-77 signal. In order to ensure error-free scanning of the edges, the function block should be called once in each PLC cycle.  Satisfactory results can be achieved with a cycle time of <= 25ms. If the DCF-77 signal is absent or faulty, the ERR output is set TRUE, and a corresponding error code is set at the ERRID output. The ERR and ERRID outputs are reset the next time a correct signal is received. Some receivers provide an inverted DCF-77 signal. In such cases the signal must first be inverted before being passed to the DCF_PULSE input. When operating without errors, the current time is updated at the CDT output every minute. When this is happening, the READY output is set to TRUE for one PLC cycle in the first second (second zero). At this time the DCF-77 time at the CDT output is valid, and can be evaluated by the PLC program. The READY output is only set if it was possible to receive the data for the coming minute without errors. The transferred parity bits are used for fault detection, and the last two telegrams are checked for plausibility. When reception is poor 100% error-free identification cannot be guaranteed, in the event of two defective (inverse) bits in two subsequent telegrams the function block cannot detect an error and will set the READY output to TRUE. Due to the plausibility check the probability of the appropriate bits becoming distorted, thereby preventing detection of such an error, is quite small.

Errors that occur during reception are registered by the function block. The ERRCNT output is an error counter. This counter indicates the number of errors that have occurred since the last correctly received signal. The counter is reset the next time a signal is correctly received.

Time code

During each minute, the numbers that encode the year, month, day, day of the week, hour and minute are transmitted in BCD format through pulse modulation of the second marks. The transmitted information always describes the subsequent minute. A second marker is transmitted each second. A second marker with a duration of 0.1 s represents a binary zero, while a duration of 0.2 s represents binary one. The information is extended with 3 check bits. No second marker is transmitted for the 59th second, and a receiver can use this "gap" to synchronise itself.


 

VAR_INPUT

VAR_INPUT
    DCF_PULSE   :BOOL;
    RUN         :BOOL;
    TLP         :TIME := 140ms;
END_VAR

DCF_PULSE: The DCF-77 signal.
RUN: A rising edge at this input initialises the function block and starts decoding the DCF-77 signal. If this input is reset, the decoding process is stopped.
TLP: Via this input a fixed limit is set for differentiating between zero and one, depending on the recipient specification. If the signal is poor the pulse widths are smaller. The receiver specifications usually contain information about the minimum and maximum pulse for the two logic signals, with the higher value expected for higher field strengths and the lower value for low field strengths or in the event of interference. Problems may also occur near the sender (where the field strength is very large) if the pulse width of the logic zero becomes excessive. Check the specification of the receiver used and configure the impulse length accordingly.

E.g.: the Atmel T4227 specification (time code receive) contains the following pulse length specification:
100 ms pulses (zero): min: 70 ms, typical: 95 ms, max: 130 ms
200 ms pulses (one): min 170 ms, typical 195 ms, max 235 ms
For this IC a limit value of 150 ms would be ideal (130 + ( ( 170 ms – 130 ms ) / 2 )).

DCF77_TIME_EX 2:

If the configured limit value for the impulse length is too small, short impulses are detected as long. Conversely, if the configured limit value is too small, long impulses are detected as short. If the checksum is correct, the receiver cannot detect these errors. In the first case the receiver may supply times that are in future range, in the second case the times may be in the past.

VAR_OUTPUT

VAR_OUTPUT
    BUSY    :BOOL;
    ERR     :BOOL;
    ERRID   :UDINT;
    ERRCNT  :UDINT;
    READY   :BOOL;
    CDT     :DATE_AND_TIME;
    DOW     :BYTE(1..7);(* ISO 8601 day of week: 1 = Monday.. 7 = Sunday *)
    TZI     :E_TimeZoneID;(* time zone information *)
    ADVTZI  :BOOL;(* MEZ->MESZ or MESZ->MEZ time change notification *)
    LEAPSEC :BOOL;(* TRUE = Leap second *)
    RAWDT   :ARRAY[0..60] OF BOOL;(* Raw decoded data bits *)
END_VAR

BUSY: This output is set when the function block is activated.
ERR: This output is set when an error occurs in the decoding.
ERRID: Supplies the error number when the ERR output is set.
ERRCNT: The number of errors that have occurred since the last correctly received signal.
READY: If this output is set, the data at the CDT output is valid.
CDT: The DCF-77 time in DATE_AND_TIME format.
DOW: day of the week according to ISO 8601: 1 = Monday... 7 = Sunday.
TZI: time zone information (daylight-saving time/standard time).
ADVTZI: daylight-saving time/standard time changeover notification, e.g. CET -> CEST or CEST -> CET. The changeover between CEST/CET occurs at the end of this hour (see telegram examples).
LEAPSEC: leap second notification. A leap second is added at the end of this hour (see telegram examples).
RAWDT: last decoded (raw) bit information. Please ensure that only the parity bits of the time information are checked. The parity bits of the weather data are not analysed.

 

Error descriptions:

Error Codes

Error descriptions

0

No error

0x100

Timeout error. Possibly because no DCF-77 signal is detected.

0x200

Parity error. Incorrect bits were detected in the received data.

0x300

Incorrect data was received. Since the parity check can only detect one incorrect bit, the received data is checked again for validity (this error code will be generated, for instance, if month = 13).

0x400

The last decoding cycle was too long. This error can occur when reception is poor (not enough second markers were received).

0x500

The last decoding cycle was too short. This error can occur when reception is poor (additional edges were received).

 

Telegram examples:

CEST -> CET (daylight-saving time -> standard time)

'0 01110100100111 011001 00011011 0100001 011001 111 00001 000100000': Sunday, 26.10.08 02:58:00, TZI = eTimeZoneID_Daylight, ADVTZI = TRUE
'0 11110001101110 011001 10011010 0100001 011001 111 00001 000100000': Sunday, 26.10.08 02:59:00, TZI = eTimeZoneID_Daylight, ADVTZI = TRUE
'0 01000001001110 010101 00000000 0100001 011001 111 00001 000100000': Sunday, 26.10.08 02:00:00, TZI = eTimeZoneID_Standard, ADVTZI = TRUE
'0 01111110100000 000101 10000001 0100001 011001 111 00001 000100000': Sunday, 26.10.08 02:01:00, TZI = eTimeZoneID_Standard, ADVTZI = FALSE

 

CET -> CEST (standard time -> daylight-saving time)

'0 01000110111010 010101 00011011 1000001 000011 111 11000 000100000': Sunday, 30.03.08 01:58:00, TZI = eTimeZoneID_Standard, ADVTZI = TRUE
'0 01000010100111 010101 10011010 1000001 000011 111 11000 000100000': Sunday, 30.03.08 01:59:00, TZI = eTimeZoneID_Standard, ADVTZI = TRUE
'0 10000111100011 011001 00000000 1100000 000011 111 11000 000100000': Sunday, 30.03.08 03:00:00, TZI = eTimeZoneID_Daylight, ADVTZI = TRUE
'0 01010000010110 001001 10000001 1100000 000011 111 11000 000100000': Sunday, 30.03.08 03:01:00, TZI = eTimeZoneID_Daylight, ADVTZI = FALSE
 

Leap second

'0 10110000100001 000111 10011010 0000000 100000 001 10000 100100001':    Thursday, 01.01.09 00:59:00, TZI = eTimeZoneID_Standard, LEAPSEC = TRUE
'0 11010010111000 000111 00000000 1000001 100000 001 10000 1001000010':  Thursday, 01.01.09 01:00:00, TZI = eTimeZoneID_Standard, LEAPSEC = TRUE
'0 01000110011101 000101 10000001 1000001 100000 001 10000 100100001':    Thursday, 01.01.09 01:01:00, TZI = eTimeZoneID_Standard, LEAPSEC = FALSE

 

  : LEAPSEC bit;

  : CET/CEST-Information;

  : ADVTZI bit;
 

 

Example:

See description of the "DCF77_TIME" function block.

 

 

Requirements

Development environment

Target system type

PLC Libraries to include

TwinCAT v2.11.0 Build > 1340 and higher

TwinCAT v2.11.0 Build > 1542 and higher

PC or CX (x86, ARM)

TcUtilities.Lib