Timing inaccuracy - any ideas?


Results 1 to 7 of 7

Threaded View

  1. #1
    Join Date
    Jan 2008
    Posts
    6

    Default Timing inaccuracy - any ideas?

    I have used a 12F675 to create a simple square wave with a duty cycle of 75% - 80% (not crucial) with a variable period which can have a number of possible values ranging from 0.714128 secs to 2.666667 secs. The circuit works as expected but seems to have a problem of accuracy and stability.

    The application requires accuracy of better than 0.01% and I would like it to be better than 10 us.

    Initially I used the internal timer, not expecting great results. In fact the output (read on a picoscope) was pretty stable down to 0.1%. Then I used an external 8 MHz crystal with inbuilt capacitor which gave slightly worse results. The period fluctuated by 2 or 3 ms.

    In both cases the period was about 4 -5 ms lower than the program should have created, which is at least 50x acceptable error.

    I have removed some of the code for clarity but the basis of the program is as follows:

    DEFINE OSC 8 'Using an 8 MHz resonator
    ANSEL=0 'Set to digital operation
    TRISIO=%00001011 'Set GP0,1 & 3 to input GP2 to output rest dont care
    OPTION_REG.7=0 'Global Weak Pull up (or use WPU=%00000011)
    CMCON=7 'comparators off

    PAUSE 100
    MAIN:
    GPIO.2=1
    PAUSE 2166 '2.166s
    PAUSEUS 667 '0.000667s
    GPIO.2=0
    PAUSE 500 '0.5s
    GOTO MAIN
    END

    Anyone got any ideas why the timing is so inaccurate?
    It's even less precise than the 555 RC circuit I built years ago to do a similar job!

    Many thanks.
    Last edited by Optech; - 1st February 2008 at 21:41. Reason: clarity

Similar Threads

  1. Any Ideas for a cheap touch sensor??????
    By rsocor01 in forum mel PIC BASIC Pro
    Replies: 17
    Last Post: - 19th October 2013, 00:33
  2. 12F683 serout timing
    By Hobie Cat in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 21st December 2009, 16:57
  3. 18F2550 timing
    By sstt1976 in forum mel PIC BASIC Pro
    Replies: 20
    Last Post: - 22nd August 2008, 00:30
  4. A category for Project Ideas
    By Pic_User in forum Forum Requests
    Replies: 2
    Last Post: - 23rd June 2006, 07:29
  5. HSEROUT buffering and timing - 16F88
    By picster in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 5th March 2006, 17:52

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