EmbeddedRelated.com
Forums

DCF77

Started by wimn.rm October 27, 2005
Tom, I got it working now. Surprizing short piece of
code afterward.
I'm not shure if it's realy failsave and how reliable
my receiver delivers it's pulses.

Thanks for your inputs!

Wim

--- Tom Becker <gtbecker@gtbe...> wrote:

> Actually, now that I think about it, my
> MSF/DCF77/WWVB decoder is an
> assembly language TSR...[]


--- In basicx@basi..., "arhodes19044" <spamiam@c...> wrote:
> Do you just know the R & C values off
> the top of your head for the 1-shot...

Would that it were so. The formula is fairly simple. The pulse width
is 0.45 * R * C for the LS123. It's different for other
technologies. With the HC series, it also varies based on supply
voltage.

Don


--- In basicx@basi..., "Don Kinzer" <dkinzer@e...> wrote:
> Would that it were so. The formula is fairly simple. The pulse
width
> is 0.45 * R * C for the LS123.

Yeah, I thought you put a bit more effort in your reply than your words
suggested.

-T



Why would you make it more complicated than it is?
Why adding external one-shots?
The call sleep() does the same thing.
Now it works, just some formatting stuff to do.
Look:

00000000000000001001100100000100010000101101000011010000
01
22:9 28-10-5

0000000000000000100100001001010001000010110100001101000001
22:10 28-10-5 Public Sub Main()

Call PutPin(DCF77,bxInputPullup)
do
tb = 0.0
do while (tb < 1.2)
t1 = timer
call getbit(bit)
debug.print cstr(bit)
t2 = timer
tb = t2 - t1
debug.print cstr(tb)
loop

debug.print "Sync gevonden"
dim i as integer
for i = 1 to 58
call getbit(bit)
debug.print cstr(bit);
index = i
call leesbaar(index,bit)
next
debug.print

debug.print cstr(uur);":";cstr(minute);"
";cstr(cal);"-";cstr(maand);"-";cstr(jaar)
loop
end sub sub getbit(bit as integer)
CB = 0

do while (cb = 0) 'Wait for a 1
CB = GetPin(DCF77) 'Get clock output
loop

call sleep(60) 'pass the 100mSec
CB = GetPin(DCF77) 'Get clock output
if (cb = 1 ) then 'still a 1 ?
bit =1 'So it's a long pulse
else
bit = 0 'It's a short pulse
end if
call sleep(100) 'to prevent entering the do-while
with a value of 1
end sub
--- arhodes19044 <spamiam@spam...> wrote:

> --- In basicx@basi..., "Don Kinzer"
> <dkinzer@e...> wrote:
> > Would that it were so. The formula is fairly
> simple. The pulse
> width
> > is 0.45 * R * C for the LS123.
>
> Yeah, I thought you put a bit more effort in your
> reply than your words
> suggested.
>
> -T >
>


Wim Nijntjes
Oranjekanaal 38 NZ
9415TP Hijken
The Netherlands

__________________________________


--- In basicx@basi..., Wim Nijntjes <wimn@r...> wrote:
> Why would you make it more complicated than it is?
> Why adding external one-shots?

The design of embedded systems involves many trade-offs, including the
hardware/software trade-offs. Sometimes, adding a bit of external
hardware solves a difficult problem whose solution fully in software
is "too expensive" in terms of the limited resources available - time,
RAM, code space, etc. Also, a software-only solution may not provide
the accuracy that is required in a particular circumstance.

It may be that using Delay() to implement the timing necessary for
accurate pulse width discrimination is a pefect solution in your
situation. Be aware, however, that Delay() only guarantees a
*minimum* delay, not a *maximum* delay. Depending on what other tasks
in your system are doing, the actual delay could be much longer than
the maximum delay that would allow accurate discrimination.

Don