Code:
'###########################################################################
'Programmname: DCF77_soft.BAS
'Aufgabe:
'Include-Programm für die dcf77.lib ab Version 4.00
'
'Hardware:
'M32 mit 8 MHz
'Es ist ein DCF-Empfänger (CONRAD 641138) an Portd.3 angeschlossen.

'###########################################################################

Config Date = Dmy , Separator = .                 'deutsches Datumsformat
Config Clock = User                               'Softclock aktivieren

$lib "dcf77_V400.lib"                             'LIB für DCF77
$external Dcf77_init
Declare Sub Dcf77_init
$external Dcf77_soft
Declare Sub Dcf77_soft

Config Timer2 = Timer , Prescale = 1024           'Timer 40Hz
Const Startwert = 61                              'Für 8MHz
Timer2 = Startwert
On Timer2 Tim2_isr                                'Überlauf 40x/s
Enable Interrupts
Enable Timer2

'---------------------- Pin für DCF Eingang definieren ---------------------
'Jeder Portpin kann benutzt werden.
'Auch in der "dcf77.lib" entsprechend anpassen !!!

Config Pind.3 = Input                             'DCF77 Eingang
Set Portd.3                                       'Pullup ein

'--------------------- Variablen der dcf77.lib -----------------------------

Dim _dayofweek As Byte , Dcfstatus As Byte , Dcfflags As Byte
'_dayofweek -> 1..7 (Mo..So)
'Dcfstatus  -> Bit0: 15. Impuls erreicht  Bit4: 58 Impulse empfangen
'              Bit1: Minutenparität OK    Bit5: Gültiges DCF77-Telegramm
'              Bit2: Stundenparität OK    Bit6: Softclock nach DCF gestellt
'              Bit3: Parität OK           Bit7: DCF-Decoder EIN
'              ACHTUNG: Bits 0..5 NUR LESEN!!!
'Dcfflags   -> Bit0 (R) : Rufbit für Alarmierung der PTB-Mitarbeiter
'              Bit1 (A1): Ankündigung des Wechsels MEZ <-> MESZ
'              Bit2 (Z1): \__ Z1/Z2: 10 = MESZ, 01 = MEZ
'              Bit3 (Z2): /
'              Bit4 (A2): Ankündigung einer Schaltsekunde
'              Bit5 (S) : Startbit f. Zeitinformationen (immer 1)
'_sec, _min, _hour, _day, _month, _year sind die Variablen der Softclock

'Interne Variablen der dcf77.lib:
Dim Dcf77counter As Byte
Dim Dcf77parity As Byte
Dim Dcf77impulse As Byte
'Dcf77buffer(9): bits 0..7, bits 8..14, flags (= bits 15..20), min, hour,
'                day, dayofweek, month, year
Dim Dcf77buffer(9) As Byte
Dim Dcf77shifter As Byte
Dim Dcf77tal As Byte
Dim Dcf77tah As Byte
Dim Dcf77hsec As Byte
Dim Dcf77bits0_7 As Byte                          'DCF77-Bits 0..7
Dim Dcf77bits8_14 As Byte                         'DCF77-Bits 8..14
Dim Dcf77val_cnt As Byte                          'Validitäts-Zähler
Dim Dcf77lastbit As Byte                          'LastBit-Pausenlänge
Dim Dcf77databit As Byte                          'DataBit-Pausenlänge

'---------------------------------------------------------------------------

Dcfstatus.7 = 0                                   'DCF-Decoder AUS
Dcfstatus.6 = 0                                   'Softclock inaktuell
Call Dcf77_init                                   'LIB initialisieren