SMPTE Timecode reader


Closed Thread
Results 1 to 10 of 10

Hybrid View

  1. #1
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    First, you can't have an accurate PAUSEUS 20 with 4MHz using PAUSEUS. See PBP manual.

    OR you could still use a Timer/Counter... or use few asm GOTO $+1 or NOP.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  2. #2


    Did you find this post helpful? Yes | No

    Default Faster will be better

    Hi Brian,
    I have not given your post its due consideration but a couple of things jump to mind.

    a/ Don't use LCDOUT in a time critical loop. The fastest indicator is to set a LED ON when the target event occurs and off at another part of the code.
    HIGH LED takes more time and code space than LED = 1 so make sure the relevant TRIS statement makes the LED pin an output then set LED = 1 instead of LCDOUT.

    b/ The statements....
    Findedge:
    A = linein
    ..dothings..
    if linein = A then Findedge

    make a looping structure that keeps going until linein changes state. It does not care whether LineIn is high or low, it just looks for a change. The assumption is that linein changes and stays changed for longer than a loop time in order to be found. Adding extras like LCDOUT can trip you up badly with fast toggling inputs. There is a problem with this approach if the state of linein changes during the ever so small time it takes to execute the 'if linein = A then findedge' line. If that happens you will miss finding sync but this will only be once every thousand or so blocks. It can be fixed.

    c/ I agree with mister-e and you really should be running a 20 MHz part at 20 MHz for anything that interacts with real world data communications.

    d/ The FindBit routine must run flat out. 20 MHz will be better than 4 MHz although it does look like 4 MH4 would be barely fast enough. You cannot have any LCDOUT or pauses in it or the routine will only find the first bit and the rest of the mesage will fall on the floor during the pause 500 line.

    You CANNOT have a pause 500 after finding sync or finding a one or zero. You must immediately gather in the full 48 or 64 bit data field and decode it. Any pauses where you show them will cause the code to immediately miss the following data bits.

    e/ I suggest the FindSync: routine should look something like.....

    FoundSync:
    LED = 1 'Shows we have met the SYNC conditions
    GetData:
    for b = 0 to 5 ' get 6 message bytes - bytes 6 & 7 are sync - so skip
    for a = 0 to 7 ' get 8 bits in each message byte
    gosub findbit
    c.0[a] = valu ' fill the 8 bits in the byte
    ' MAY need a tweak to get MSB/LSB sense correct
    next a
    msg[b] = c
    LED = 0 ' turn the LED off after one character time - about 4 mSecs
    next b

    -or- shift the LED = 0 command to after the 'next b' and have the LED on for 6 character times which may be easier to see.

    HTH
    Brian

Similar Threads

  1. Parallax RFID Reader code example
    By dan-tron in forum Code Examples
    Replies: 4
    Last Post: - 19th April 2013, 22:16
  2. How to generate SMPTE timecode?
    By gtvmarty in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 9th April 2009, 05:53
  3. Serial interface with RFID reader
    By brid0030 in forum Serial
    Replies: 8
    Last Post: - 23rd January 2007, 06:23
  4. Proximity Card Reader
    By Sphere in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 6th November 2005, 14:43
  5. Smart card reader with PIC16F84A
    By bangunprayogi in forum Serial
    Replies: 0
    Last Post: - 12th August 2005, 10:36

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts