Binary Clock


Closed Thread
Results 1 to 5 of 5

Thread: Binary Clock

Hybrid View

  1. #1
    Scottacus's Avatar
    Scottacus Guest

    Default Binary Clock

    Hi, I'm new to this forum and was wondering if anybody could help me with timing on a binary clock that I am programming. I'm sure that my code is not the most efficient but I need to waste some time in the routine and is there anyplace that will tell me how long it takes to execute PortB and PortA commands as well as: for, next and assignments like MinuteOnes = Minute//10. I've been tweaking here and there on a bread board and I can get close but have not hit the timing right as of yet. I am using a 20MHz clocking crystal with a PIC F84A processor. I assume that a pause will take 1/5 of a milisecond. Thanks!

  2. #2
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    You are heading in the wrong direction.

    Unlike raw Assembler instructions, you cannot easily calculate which PICBasic Commands execute at what speed.

    To produce a clock with any accuracy, you need to refence to an accurate source of ticks... like any one of the PICs on-board timers or an external RTC chip.

  3. #3
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,648


    Did you find this post helpful? Yes | No

    Default

    Hi,

    One working ... but in assembler !!! :

    Elektor project 020390 ... ASM files downloadable.

    Alain
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  4. #4
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    I did say "unlike Assembler", wherein you can easily calculate the execution time of each instruction. But even then you are relying on the PICs clock for your accuracy. Let's face it, 20MHz (the speed mentioned by Scottacus - didn't he meet a sticky end at the end of the film?) from a crystal just isn't going to produce 20.000000MHz.

    Unfortunately you just can't with PBP. Even execution of a simple a=b+c will depend if the variables reside in Bank0 or elsewhere or if they're Bytes or Words or a mix of both. You can probably have twenty speed permutations of that simple statement alone depending on the conditions I've stated above.

  5. #5
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,648


    Did you find this post helpful? Yes | No

    Wink

    Hi, Mel

    These days, I made a turnaround aboard a 16F628 ... reading TMR1 to measure the real calculating time ...

    was an Electronic ignition for cars ...

    Alain
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

Similar Threads

  1. Single digit 7 Seg LED clock - PIC16F88
    By thirsty in forum Code Examples
    Replies: 4
    Last Post: - 17th July 2009, 08:42
  2. UberNewbie can't set his clock...
    By Byte_Butcher in forum General
    Replies: 19
    Last Post: - 7th January 2009, 04:22
  3. EM4095 Chip, get Clock and Data signals?
    By mindthomas in forum mel PIC BASIC Pro
    Replies: 14
    Last Post: - 19th August 2008, 06:27
  4. Shiftout/in
    By BobEdge in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 23rd August 2007, 11:48
  5. Help with sound command in 2 programs
    By hyperboarder in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 5th July 2007, 20: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