Calculations for using faster Clocks.


Closed Thread
Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2005
    Location
    Essex, UK
    Posts
    154

    Default Calculations for using faster Clocks.

    Is there a set calculation for using a faster clock?

    I initially used a 4Mhz resonator, which has now been changed to a 20Mhz to get smoother PMW.

    In my code it has many PAUSE commands and FOR...NEXT Loops.

    It states in the manual:

    PAUSE assumes an oscillator frequency of 4MHz. If an oscillator other
    that 4MHz is used, PBP must be told using a DEFINE OSC command.
    See the section on speed for more information.

    PAUSE 1000 ‘ Delay for 1 second
    Therefore, I appriciate that any PAUSE X command will not be affected as long as the DEFINE OSC command is used, as 50ms is 50ms.

    However, a FOR...NEXT Loop will be affected as it will get from 1 to 100, for example, quicker.

    Is it as simple as changing the FOR...NEXT Loop to be 5 times longer. ie instead of:

    FOR Time = 1 TO 100 (4MHz Version).

    It'll be:

    FOR Time = 1 TO 500 (20Mhz Version).

    Is it as simple as that or is there any easier way round things insead of going through all the code and increasing some of the Variables by 500%.

    Many Thanks,

    Steve

  2. #2
    Join Date
    Feb 2005
    Location
    Essex, UK
    Posts
    154


    Did you find this post helpful? Yes | No

    Default

    Cancel my last, i think i found what the problem was.

    Although i thought i was defining the OSC speed, it appears i wasn't. Which is why the program was contradicting the manual.

    It would appear that the Define Osc needs to be in capitals, ie.

    DEFINE OSC 20

    and not

    define osc 20

    We Live and learn.

    Steve

Similar Threads

  1. OT - Firefox browser - faster performance
    By malc-c in forum Off Topic
    Replies: 2
    Last Post: - 14th August 2006, 10:33

Members who have read this thread : 1

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