As they were very cheap I bought a DCF77 receiver from aliexpress. It receives the time code transmissions from Mainflingen in Germany on 77.5 kHz (VLF) https://en.wikipedia.org/wiki/DCF77
The unit comes with a ferrite rod aerial an amplifier chip with a crystal filter (77.5 kHz I suppose) and very little other information. So I have got it to work; here is the code...
I have also attached a picture.
#chip 12F1840,.25#config osc=intosc,wdte=off,mclr=off,boren=off' Define HI2C settings#define HI2C_BAUD_RATE 25#define HI2C_DATA PORTA.2#define HI2C_CLOCK PORTA.1DirHI2C_DATAinDirHI2C_CLOCKinHI2CModeMasterwait100msdirporta.3in'data pindirporta.0out'not useddirporta.4out'not useddirporta.5out'not usedsetporta.0off'pon off=onsetporta.4offsetporta.5offoption_reg.7=0wpua=b'00000110''HI2C pinsSL=0x7C'DISPLAY IDCOMSEND=0x00'display COMMAND sendDS=0X40'display DATA sendwait10msonetwoline'initialize LCDwait10msj=0kmin1=0:kmin=0khour1=0:khour=0kday1=0:kday=0kmonth1=0:kmonth=0kyear1=0:kyear=0'initialize constantst1con=b'00000100''t1con.0 timer1 is on/offpir1.0=0'set interrupt flag offintcon.6=1'enable peripheral interruptst1gcon.7=0'timer1 continuous countingtmr1l=0tmr1h=0t1con.0=1'timer onpie1.0=1'timer1 overflow Interrupt'start of main loop...doxyz:doifporta.3=1thenexitdoifpir1.0=1thenexitdoloopifpir1.0=1then'detected missing pulse at 59 secj=59screen3pir1.0=0tmr1l=0tmr1h=0gotoxyzendififj=59andpir1.0=0thenj=0khour1=khour'update on minute roll-overkmin1=kminkday1=kdaykmonth1=kmonthkyear1=kyearkhour=0kmin=0kday=0kmonth=0kyear=0endiftmr1l=0tmr1h=0screen3j=j+1'j is the second countdoifporta.3=0thenexitdoloopid7=tmr1h'id7=37 is about 150 msjj=j-1'one second ahead!'binary coded decimal (arrgh!!)ifid7>37thenifjj=21thenkmin=kmin+1ifjj=22thenkmin=kmin+2ifjj=23thenkmin=kmin+4ifjj=24thenkmin=kmin+8ifjj=25thenkmin=kmin+10ifjj=26thenkmin=kmin+20ifjj=27thenkmin=kmin+40ifjj=29thenkhour=khour+1ifjj=30thenkhour=khour+2ifjj=31thenkhour=khour+4ifjj=32thenkhour=khour+8ifjj=33thenkhour=khour+10ifjj=34thenkhour=khour+20ifjj=36thenkday=kday+1ifjj=37thenkday=kday+2ifjj=38thenkday=kday+4ifjj=39thenkday=kday+8ifjj=40thenkday=kday+10ifjj=41thenkday=kday+20ifjj=45thenkmonth=kmonth+1ifjj=46thenkmonth=kmonth+2ifjj=47thenkmonth=kmonth+4ifjj=48thenkmonth=kmonth+8ifjj=49thenkmonth=kmonth+10ifjj=50thenkyear=kyear+1ifjj=51thenkyear=kyear+2ifjj=52thenkyear=kyear+4ifjj=53thenkyear=kyear+8ifjj=54thenkyear=kyear+10ifjj=55thenkyear=kyear+20ifjj=56thenkyear=kyear+40ifjj=57thenkyear=kyear+80endifpir1.0=0'make sure!tmr1l=0tmr1h=0loopend'should never get heresubscreen3hi2cstarthi2csEND(Sl)hi2csEND(Comsend)hi2csend(0x80)'first linehi2cstopj1=j/10j2=j%10hi2cstarthi2csend(Sl)hi2csend(DS)hi2csend(khour1/10+48)hi2csend(khour1%10+48)hi2csend(32)hi2csend(58)hi2csend(32)hi2csend(kmin1/10+48)hi2csend(kmin1%10+48)hi2csend(32)hi2csend(58)hi2csend(32)hi2csend(j1+48)hi2csend(j2+48)hi2csend(32)hi2cSTOPhi2cStarthi2cSEND(Sl)hi2cSEND(Comsend)hi2csend(0xC0)'second linehi2cstophi2cstarthi2cSEND(Sl)hi2cSEND(DS)hi2csend(kday1/10+48)hi2csend(kday1%10+48)hi2csend(32)hi2csend(47)hi2csend(32)hi2csend(kmonth1/10+48)hi2csend(kmonth1%10+48)hi2csend(32)hi2csend(47)hi2csend(32)hi2csend(50)hi2csend(48)hi2csend(kyear1/10+48)hi2csend(kyear1%10+48)hi2csend(32)hi2cstopendsubsubonetwoline'initialize displaySL=0x7C'DISPLAY IDCOMSEND=0x00'display COMMAND sendDS=0X40'display DATA sendchht=0x38'two lineshi2cStarthi2cSEND(Sl)hi2cSEND(Comsend)hi2cSEND(chht)'initialize 16x1or2hi2cSEND(COMSEND)hi2cSEND(chht+1)'16x1or2hi2cSEND(0x10)'osc set to slowesthi2cSEND(0x77)'contrast low byte=3 now 5 now 7hi2cSEND(0x54)'pwr booster onhi2cSEND(0x6F)'followerhi2cSEND(0x0C)'on/offhi2cSEND(0x01)'clearhi2cstopendsub
So what about the UK time signals (MSF on 60 kHz)?
Aliexpress offer a dual frequency (40 and 60 kHz) VLF receiver (the 40 kHz is for the Japanese VLF transmissions). The problem (as ever) is there is little to no information supplied. I tried all possible combinations of pins high and low and could not get it to work. So the solution was to remove the 60kHz crystal and put it onto a DCF77 board (I also swapped the ferrite inductors, but this made little difference).
UK VLF time signals used to be broadcast from Rugby - a nice central location. Now they are broadcast from Anthorn in Cumbria (almost in Scotland) . This is a long way from me in fact the German one is probably nearer (and is definitely more powerful 50kW versus 17kW).
As is to be expected the coding is different. Rather than a missing pulse on the minute MSF60 has an extra long pulse (500ms) on the minute. Other than that it is a mixture of long (200ms) and short pulses (100ms) to give the BCD time (except near the minute there can be 300ms pulses "as a parity check"). The code is below. I used a 12LF1552 (as I have no 12F1840's left). It only has a 8-bit counter (timer0), but with the prescaler (256:1) it is essentially 16-bit (with only the high byte accessible).
#chip 12LF1552,.25#config osc=intosc,wdte=off,mclr=off,boren=off' Define HI2C settings#define HI2C_BAUD_RATE 25#define HI2C_DATA PORTA.2#define HI2C_CLOCK PORTA.1DirHI2C_DATAinDirHI2C_CLOCKinHI2CModeMasterwait20msdirporta.3in'mclr pindirporta.0out'pon=power ondirporta.4in'time pulsesdirporta.5out'out n/csetporta.0off'pon off=onsetporta.5offoption_reg=b'00000111'wpua=b'00000110''HI2C pinswait20msonetwoline'initialize LCDwait20msjj=0kmin1=0:kmin=0khour1=0:khour=0kday1=0:kday=0kmonth1=0:kmonth=0kyear1=0:kyear=0'initialize constantstmr0=0'start of main loop...dodoifporta.4=1thenexitdo'start of pulselooptmr0=0doifporta.4=0thenexitdo'end of pulseloopjj=jj+1id7=tmr0'id7=37 is about 150 msifid7<110thenscreen3tmr0=0ifid7>110then'found minute markerjj=0khour1=khour'update on minute roll-overkmin1=kminkday1=kdaykmonth1=kmonthkyear1=kyearkhour=0kmin=0kday=0kmonth=0kyear=0screen3endif'binary coded decimal (arrgh!!)ifid7>37andid7<72thenifjj=51thenkmin=kmin+1ifjj=50thenkmin=kmin+2ifjj=49thenkmin=kmin+4ifjj=48thenkmin=kmin+8ifjj=47thenkmin=kmin+10ifjj=46thenkmin=kmin+20ifjj=45thenkmin=kmin+40ifjj=44thenkhour=khour+1ifjj=43thenkhour=khour+2ifjj=42thenkhour=khour+4ifjj=41thenkhour=khour+8ifjj=40thenkhour=khour+10ifjj=39thenkhour=khour+20ifjj=35thenkday=kday+1ifjj=34thenkday=kday+2ifjj=33thenkday=kday+4ifjj=32thenkday=kday+8ifjj=31thenkday=kday+10ifjj=30thenkday=kday+20ifjj=29thenkmonth=kmonth+1ifjj=28thenkmonth=kmonth+2ifjj=27thenkmonth=kmonth+4ifjj=26thenkmonth=kmonth+8ifjj=25thenkmonth=kmonth+10ifjj=24thenkyear=kyear+1ifjj=23thenkyear=kyear+2ifjj=22thenkyear=kyear+4ifjj=21thenkyear=kyear+8ifjj=20thenkyear=kyear+10ifjj=19thenkyear=kyear+20ifjj=18thenkyear=kyear+40ifjj=17thenkyear=kyear+80endiftmr0=0loopend'should never get heresubscreen3hi2cstarthi2csEND(Sl)hi2csEND(Comsend)hi2csend(0x80)'first linehi2cstopj1=jj/10j2=jj%10hi2cstarthi2csend(Sl)hi2csend(DS)hi2csend(khour1/10+48)hi2csend(khour1%10+48)hi2csend(32)hi2csend(58)hi2csend(32)hi2csend(kmin1/10+48)hi2csend(kmin1%10+48)hi2csend(32)hi2csend(58)hi2csend(32)hi2csend(j1+48)hi2csend(j2+48)hi2csend(32)hi2cSTOPhi2cStarthi2cSEND(Sl)hi2cSEND(Comsend)hi2csend(0xC0)'second linehi2cstophi2cstarthi2cSEND(Sl)hi2cSEND(DS)hi2csend(kday1/10+48)hi2csend(kday1%10+48)hi2csend(32)hi2csend(47)hi2csend(32)hi2csend(kmonth1/10+48)hi2csend(kmonth1%10+48)hi2csend(32)hi2csend(47)hi2csend(32)hi2csend(50)hi2csend(48)hi2csend(kyear1/10+48)hi2csend(kyear1%10+48)hi2csend(32)hi2cstopendsubsubonetwoline'initialize displaySL=0x7C'DISPLAY IDCOMSEND=0x00'display COMMAND sendDS=0X40'display DATA sendchht=0x38'two lineshi2cStarthi2cSEND(Sl)hi2cSEND(Comsend)hi2cSEND(chht)'initialize 16x1or2hi2cSEND(COMSEND)hi2cSEND(chht+1)'16x1or2hi2cSEND(0x10)'osc set to slowesthi2cSEND(0x77)'contrast low byte=3 now 5 now 7hi2cSEND(0x54)'pwr booster onhi2cSEND(0x6F)'followerhi2cSEND(0x0C)'on/offhi2cSEND(0x01)'clearhi2cstopendsub
As they were very cheap I bought a DCF77 receiver from aliexpress. It receives the time code transmissions from Mainflingen in Germany on 77.5 kHz (VLF)
https://en.wikipedia.org/wiki/DCF77
The unit comes with a ferrite rod aerial an amplifier chip with a crystal filter (77.5 kHz I suppose) and very little other information. So I have got it to work; here is the code...
I have also attached a picture.
So what about the UK time signals (MSF on 60 kHz)?
Aliexpress offer a dual frequency (40 and 60 kHz) VLF receiver (the 40 kHz is for the Japanese VLF transmissions). The problem (as ever) is there is little to no information supplied. I tried all possible combinations of pins high and low and could not get it to work. So the solution was to remove the 60kHz crystal and put it onto a DCF77 board (I also swapped the ferrite inductors, but this made little difference).
UK VLF time signals used to be broadcast from Rugby - a nice central location. Now they are broadcast from Anthorn in Cumbria (almost in Scotland) . This is a long way from me in fact the German one is probably nearer (and is definitely more powerful 50kW versus 17kW).
As is to be expected the coding is different. Rather than a missing pulse on the minute MSF60 has an extra long pulse (500ms) on the minute. Other than that it is a mixture of long (200ms) and short pulses (100ms) to give the BCD time (except near the minute there can be 300ms pulses "as a parity check"). The code is below. I used a 12LF1552 (as I have no 12F1840's left). It only has a 8-bit counter (timer0), but with the prescaler (256:1) it is essentially 16-bit (with only the high byte accessible).