Pause


Closed Thread
Results 1 to 8 of 8

Thread: Pause

  1. #1
    blue's Avatar
    blue Guest

    Default Pause

    with oscillator frequency of 4MHz. The command of pause will pause the program in milliseconds.e.g pause 1000 for delay of 1 second. May i know that how it's to calculate each pause is 1 milisecond consists of 4Mhz??
    Is't come from the equation of T=1/f?

  2. #2
    Join Date
    Mar 2003
    Location
    Commerce Michigan USA
    Posts
    1,166


    Did you find this post helpful? Yes | No

    Default

    blue, Pause is one of the commands that PBP uses the OSC= directive to calculate the timing in milliseconds. As long as you have declared the oscillator frequency using one of the available choices, PBP will set the step size to 1 millisecond.

    Dave Purola,
    N8NTA

  3. #3
    blue's Avatar
    blue Guest


    Did you find this post helpful? Yes | No

    Default

    By using different PIC with different frequeacy, would it affect the delay time?
    let saying that using 20Mhz PIC, 5 times faster that 4Mhz PIC, would it shoter the delay time 5 times compare to the 4Mhz PIC?
    appreciate for yr reply.
    Last edited by blue; - 21st December 2005 at 03:45.

  4. #4
    Join Date
    Mar 2003
    Location
    Commerce Michigan USA
    Posts
    1,166


    Did you find this post helpful? Yes | No

    Default

    blue, As I stated before the instruction PAUSE does the math at compile time to give the instruction a minimum resolution of 1 millisecond depending on your selection of oscillator frequency defined by the OSC= function. It diesn't mater which pic micro you chose.

    Dave Purola,
    N8NTA

  5. #5
    blue's Avatar
    blue Guest


    Did you find this post helpful? Yes | No

    Default

    Dave, i understand what you are trying to say. But, in microengineering website, there got a resources/information about using pic basic compiler. inside there, got a statement as below,try to read it.
    --------------------------------------------------------
    A part of statement:
    PICBASIC™ Compiler programs may be run at clock frequencies other than 4MHz if you pay attention to what happens to the time dependent instructions. If you wish to run the serial bus at 19,200 as described above, you would simply clock the PICmicro MCU with an 8MHz crystal rather than a 4MHz crystal. This, in effect, makes everything run twice as fast, including the SERIN and SEROUT commands. If you tell SERIN or SEROUT to run at 9600 baud, the doubling of the crystal speed will double the actual baud rate to 19,200 baud.

    However, keep in mind commands such as PAUSE and SOUND will also run twice as fast. The Pause 1000 mentioned above would only wait .5 seconds with an 8MHz crystal before allowing program execution to continue.
    --------------------------------------------------------
    This is why i'm trying to ask the question about PAUSE/PAUSEUS command.

  6. #6
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    blue,

    From that I can see that you are using the PICBASIC™ Compiler , or at least you're reading the PBC manual.

    For PBC, all programs are assumed to run at 4Mhz. So yes, if you run it at 8Mhz instead, everything will be twice as fast, or take half the time, which ever way you want to look at it. (Glass half empty thing)

    With PicBasic Pro, there is the OSC define that allows the compiler to compensate for the different oscillator speeds.

    And, PBC doesn't have a PAUSEUS command.
    <hr>
    PBC questions can be a little confusing outside of it's own forum.
    mel PIC BASIC
    http://www.picbasic.co.uk/forum/forumdisplay.php?f=3
    Last edited by Darrel Taylor; - 23rd December 2005 at 06:31.
    DT

  7. #7
    blue's Avatar
    blue Guest


    Did you find this post helpful? Yes | No

    Default

    Thanks for your help.

  8. #8
    Join Date
    Mar 2003
    Location
    Commerce Michigan USA
    Posts
    1,166


    Did you find this post helpful? Yes | No

    Default

    blue, Yes you are right, If you declare the OSC= to 1 frequency and use an actual crystal thet is double the defined frequency all of the timed statements used by PBP will run at twice the specified timing.

    Dave Purola,
    N8NTA

Similar Threads

  1. Delayed output 10 secs
    By lilimike in forum mel PIC BASIC Pro
    Replies: 37
    Last Post: - 14th October 2011, 06:28
  2. Old and beyond help ?
    By DavidFMarks in forum mel PIC BASIC Pro
    Replies: 46
    Last Post: - 11th December 2008, 15:23
  3. Replies: 11
    Last Post: - 12th July 2008, 02:36
  4. Fade out LEDs question
    By Sam in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 22nd June 2008, 10:50
  5. Help Quick Need to make code smaller
    By Programmednew in forum mel PIC BASIC Pro
    Replies: 41
    Last Post: - 25th January 2005, 03:46

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