Command execution time


Closed Thread
Results 1 to 3 of 3
  1. #1
    barkerben's Avatar
    barkerben Guest

    Default Command execution time

    I really must stop posting ....


    Is there any reference that shows how long each command takes to execute in PICBasic for a given clock speed?

    I have a main loop that does nothing bit set pins and evaluate IF THEN statements while waiting for interrupts, so ideally they should all be serviced very quickly, but wheras in assembler its easy to find out (hard to write) in Basic it seems the reverse. Any thoughts?


    Ben

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


    Did you find this post helpful? Yes | No

    Default

    for a 4MHZ clock, most command will be executed in *about* 4us but can be tested/measure easilly in a loop.

    loop:
    High OneUnusedPin

    ' code here

    Low OneUnusedPin

    goto loop

    place a scope/frequency meter on OneUnusedPin and now you have a good idea of the execution time.

    regards
    Steve

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

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


    Did you find this post helpful? Yes | No

    Default

    Hi barkerben,

    You can also time the instructions using Timer1.

    For an example of how to... See this thread.

    http://www.picbasic.co.uk/forum/show...=&threadid=365

    HTH,
    Darrel

Similar Threads

  1. I don't understand this code!
    By Russ Kincaid in forum mel PIC BASIC Pro
    Replies: 46
    Last Post: - 13th February 2008, 02:55
  2. Measuring time
    By AugustoPedrone in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 30th July 2007, 23:46
  3. Serout2/serin2 Pbp Problem
    By SOMRU in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 11th December 2006, 19:55
  4. Alarm Time
    By Santana in forum Code Examples
    Replies: 1
    Last Post: - 8th December 2006, 13:58
  5. Timer in real time
    By martarse in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 29th July 2005, 14:24

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