Shop OBEX P1 Docs P2 Docs Learn Events
Decoding DCF77 — Parallax Forums

Decoding DCF77

Robert NixdorfRobert Nixdorf Posts: 2
edited 2007-07-31 18:19 in Propeller 1
Hi,

im trying to decode the german time-signal DCF77. It's a signal in which ever second one bit is transmitted by a Pulse of 0,1s for "0" and 0,2s of "1" in second 59 the pulse is left out to sync
on the beginning of new transmission.

I've tried to write some code that displays the length of pulse on VGA but it doesn't work and I don't know why.


pri bitout | tick, tick2, dcf, bit 
  dira[noparse][[/noparse]14]~
  text.Start(16)
  text.out($00)
  text.out($22)
  repeat
    text.out("a")
    'text.dec(bit)
    bit:=0
    text.out("b") 
    repeat
      dcf:=ina[noparse][[/noparse]14]
      text.out("c")
      mSdelay(1)
      bit++
      text.dec(bit)
    until !dcf
    repeat
      dcf:=ina[noparse][[/noparse]14]
      ' bit:=0
    until dcf
   
  '  text.dec(bit)
    text.out($0D)




Thank You for Helping

Comments

  • StefanL38StefanL38 Posts: 2,292
    edited 2007-07-30 16:29
    Hello Robert Nixdorf,

    as you can read in the manual on page 272

    Bitwise NOT ‘!’

    The Bitwise NOT ‘!’ operator performs a bitwise NOT (inverse, or one’s-complement) of the
    bits of the operand that follows it. Bitwise NOT can be used in both variable and integer
    constant expressions, but not in floating-point constant expressions.
    Each bit of the two operands is subject to the following logic:
    Table 4-14: Bitwise NOT Truth Table
    Bit State Result
    0 1
    1 0
    Example:
    X := !%00101100
    The above example NOTs %00101100 and writes the result, %11010011, to X.

    Bitwise NOT becomes an assignment operator when it is the sole operator to the left of a
    variable on a line by itself. For example:
    !Flag
    This would store the inverted value Flag back into Flag.
    Be careful not to get Bitwise NOT ‘!’confused with Boolean NOT ‘NOT’. Bitwise NOT is for
    bit manipulation while Boolean NOT is for comparison purposes (see page 274).

    so your "until !dcf" will invert the value of dcf and then the value is evaluated for the "until"-condition

    i haven't testet it on the propellerchip but try

    "until dcf == 1" using "==" makes a comparison without affecting the value of dcf
    ATTENTION you HAVE to use double"=" "=="

    a single "=" gives dcf a new value and then the new value is evaluated for the until-condition
  • Marcel MajoorMarcel Majoor Posts: 2
    edited 2007-07-30 17:10
    Here is a, ready made, DCF77 decoder.
    Using a state machine, each second is divided up in 10 ms intervals. Using these intervals the pulse length is decided upon and acted on accordingly.
    Typically you only need to modify 'CDcfIn', 'CDcfOut' and 'CDcfLevel' if different hardware/connections are used.
    I know it is not direct answer to your question, but the state machine approach is a relative easy way to detect the pulse length.
    The code contains some debug information which can be used to show the realtime acquisition of the DCF signal (e.g. GetBitNumber / GetBitLevel / GetBitError).
    Besides the DCF77 decoder code, there is also a LCD driver (character LCD, 4/8 bit parallel access) included, mainly because it is used by the demo code.
    It should be possible to remove all LCD code from the DCF77_demo code to make it work with only the TV output.
  • deSilvadeSilva Posts: 2,967
    edited 2007-07-30 18:31
    Great Marcel, I shall try that, as soon as I have refound my DCF receiver, mislaid for a year or so smile.gif

    @Robert: I remember I had problems with the output of my DCF receiver, bought from the popular Reichelt shop

    (a) You must not connect the ON ("ein") pin, neither to ground nor to Vcc, the receiver worked only without any input
    (b) Signals turned out to be +/- 1,5 V rather than 1 to 4 V as documented (@ 5 V supply)

    (If I remember this correctly...)

    Have you checked with a 'scope?

    Post Edited (deSilva) : 7/30/2007 6:38:53 PM GMT
  • Robert NixdorfRobert Nixdorf Posts: 2
    edited 2007-07-31 00:34
    @ StefanL38:

    Thanks for helping me to remind me what's standing in the Manual·;-)
    I've read that, but then... forgot it again

    @ Marcel

    Nice, probably working objekts, if I don't make it writing my own,
    ·because thats what i'm trying. Just for exercise. If I'm done or completly
    frustrated ;-) I'll have a look.


    @desilva

    Hehe^^

    Jepp the reciever from Richelt...
    After my first code didn't work, I started searching the mistake.
    a) It's correct no input at all.
    b) I tested if the Propeller would accept the levels of the reciever with some code that
    ·shows the input of the reciever on anouther output: it does. but could be that the pulse ist'n
    recognized as one pulse but is close to the threshold. But the Ozzi is somewhere behind my bed.
    So far, far away. but I'll check it tomorrow.



    ·
  • deSilvadeSilva Posts: 2,967
    edited 2007-07-31 18:19
    Read the comments in MM's driver! He also gives a circuit for a voltage stabilization which seems neccessary. The receiver is VERY susceptable to any noise on the power supply!!
Sign In or Register to comment.