Saturday, 20 July 2019
     
 
Main Menu
Home Home
Shop Shop
News News
BASCOM-AVR BASCOM-AVR
BASCOM-8051 BASCOM-8051
Products Products
Application Notes Application Notes
Publications Publications
Links Links
Support Center Support Center
Downloads Downloads
Forum Forum
Resellers Resellers
Contact Us Contact Us
Updates Updates
MCS Wiki MCS Wiki
Online Help
BASCOM-AVR Help BASCOM-AVR Help
BASCOM-8051 Help BASCOM-8051 Help
Contents in Cart
Show Cart
Your Cart is currently empty.
Search the Shop

Products Search

User Login
Username

Password

If you have problem after log in with disappeared login data, please press F5 in your browser

RSS News
 
     
 

 
   
     
 
AN #28 - DCF-77 clock Print
DCF-77 clock

DCF-77 clock by Masnica Taborak

Masnica contributed this DCF-77 program for BASCOM-8051. At www.hw.cz/english/docs/dcf/dcf.html you can find more info about DCF-77.

Download source code in .BAS file

 

'******************************************************************************
' DCF-77 decoder - LCD display 2x16 demo for 89C2051-89C52
' input - module DCF-77
'
'5V---------| |------| |--
' | | | |
' |_| |_|
'
' pulse 100ms log. L 200ms log. H
'
' info for DCF-77 : www.hw.cz/english/docs/dcf/dcf.html

' autor : masnica@taborak cz web.redbox.cz/masnica
' 10.9.2001
'******************************************************************************
'
$crystal = 11059000
$baud = 9600
'
'******************************************************************************
'
Dim X As Byte
Dim C As Byte
Dim V As Byte
Dim H As Byte
Dim Eror As Byte
Dim Znak As Byte
'
Dim M1 As Byte
Dim M2 As Byte
Dim H1 As Byte
Dim H2 As Byte
Dim D1 As Byte
Dim D2 As Byte
Dim Me1 As Byte
Dim Me2 As Byte
Dim R1 As Byte
Dim R2 As Byte
'
Dim Dm1 As Byte
Dim Dm2 As Byte
Dim Dh1 As Byte
Dim Dh2 As Byte
Dim Dd1 As Byte
Dim Dd2 As Byte
Dim Dme1 As Byte
Dim Dme2 As Byte
Dim Dr1 As Byte
Dim Dr2 As Byte
'
'******************************************************************************
'
' display 2x16
Config Lcdpin = Pin , Db4 = P1.3 , Db5 = P1.2 , Db6 = P1.1 , Db7 = P1.0 , E = P3.4 , Rs = P3.5
Config Lcd = 16 * 2
' input
Dcf77
Alias P1.7 'input module DCF-77
'
'******************************************************************************
'
Inic
:
Eror
= 0
Cls
Locate 1 , 1
Lcd "Time Date"
Cursor Off
'm1 = 0 : M2 = 0 : H1 = 0 : H2 = 0 : D1 = 0 : D2 = 0
'Me1 = 0 : Me2 = 0 : R1 = 0 : R2 = 0
Dm1
= 0 : Dm2 = 0 : Dh1 = 0 : Dh2 = 0 : Dd1 = 0 : Dd2 = 0
Dme1
= 0 : Dme2 = 0 : Dr1 = 0 : Dr2 = 0
C
= 100
'
Zacatek
:
D99
:
X
= 0
If Dcf77 = 1 Then Goto D0
Goto D99
'
D0
:
X
= 0
If Dcf77 = 0 Then Goto D1
Goto D0
'
D1
:
Waitms 10
X
= X + 1
If Dcf77 = 1 Then Goto D2
Goto D1
'
D2
:
If X < 12 Then Goto S0
If X > 12 Then Goto S1
Eror
= 1
S0
:
H
= 0
X
= 0
Goto Vypocet
S1
:
H
= 1
X
= 0
Goto Vypocet
'
D3
:
Waitms 10
X
= X + 1
If Dcf77 = 0 Then Goto D4
Goto D3
'
D4
:
If X > 150 Then Goto M9
X
= 0
Goto D1
'
M9
:
'
If H1 > 2 Then Eror = 1
If H2 > 9 Then Eror = 1
If M1 > 6 Then Eror = 1
If M2 > 9 Then Eror = 1
If Me1 > 1 Then Eror = 1
If Me2 > 9 Then Eror = 1
If R1 > 1 Then Eror = 1
If R2 > 9 Then Eror = 1
'
If Eror = 1 Then Goto Nodispl
'
Locate 2 , 1
X
= H1 + 48
Dh1
= X
Lcd Chr(x);
X
= H2 + 48
Dh2
= X
Lcd Chr(x);
Lcd ":";
X
= M1 + 48
Dm1
= X
Lcd Chr(x);
X
= M2 + 48
Dm2
= X
Lcd Chr(x);
Lcd " ";
X
= D1 + 48
Dd1
= X
Lcd Chr(x);
X
= D2 + 48
Dd2
= X
Lcd Chr(x);
Lcd ".";
X
= Me1 + 48
Dme1
= X
Lcd Chr(x);
X
= Me2 + 48
Dme2
= X
Lcd Chr(x);
Lcd ".20";
X
= R1 + 48
Dr1
= X
Lcd Chr(x);
X
= R2 + 48
Dr2
= X
Lcd Chr(x)
'
Nd1
:
Eror
= 1
'
Nodispl
:
M1
= 0 : M2 = 0 : H1 = 0 : H2 = 0 : D1 = 0 : D2 = 0
Me1
= 0 : Me2 = 0 : R1 = 0 : R2 = 0
X
= 0 : C = 1 : Eror = 0
Goto D1
'
Vypocet
:
If C = 21 Then
If H = 0 Then Eror = 1
End If
If C = 22 Then M2 = M2 + H
If C = 23 Then
V
= H * 2
M2
= M2 + V
End If
If C = 24 Then
V
= H * 4
M2
= M2 + V
End If
If C = 25 Then
V
= H * 8
M2
= M2 + V
End If
If C = 26 Then M1 = H
If C = 27 Then
V
= H * 2
M1
= M1 + V
End If
If C = 28 Then
V
= H * 4
M1
= M1 + V
End If
If C = 30 Then H2 = H
If C = 31 Then
V
= H * 2
H2
= H2 + V
End If
If C = 32 Then
V
= H * 4
H2
= H2 + V
End If
If C = 33 Then
V
= H * 8
H2
= H2 + V
End If
If C = 34 Then H1 = H
If C = 35 Then
V
= H * 2
H1
= H1 + V
End If
If C = 37 Then D2 = H
If C = 38 Then
V
= H * 2
D2
= D2 + V
End If
If C = 39 Then
V
= H * 4
D2
= D2 + V
End If
If C = 40 Then
V
= H * 8
D2
= D2 + V
End If
If C = 41 Then D1 = H
If C = 42 Then
V
= H * 2
D1
= D1 + V
End If
If C = 46 Then Me2 = H
If C = 47 Then
V
= H * 2
Me2
= Me2 + V
End If
If C = 48 Then
V
= H * 4
Me2
= Me2 + V
End If
If C = 49 Then
V
= H * 8
Me2
= Me2 + V
End If
If C = 50 Then Me1 = H
If C = 51 Then R2 = H
If C = 52 Then
V
= H * 2
R2
= R2 + V
End If
If C = 53 Then
V
= H * 4
R2
= R2 + V
End If
If C = 54 Then
V
= H * 8
R2
= R2 + V
End If
If C = 55 Then R1 = H
If C = 56 Then
V
= H * 2
R1
= R1 + V
End If
If C = 57 Then
V
= H * 4
R1
= R1 + V
End If
If C = 58 Then
V
= H * 8
R1
= R1 + V
End If
C
= C + 1
Goto D3
'
End