Hot!Time measurement of code execution

Author
naeem1234
Super Member
  • Total Posts : 362
  • Reward points : 0
  • Joined: 2015/02/19 06:39:28
  • Location: 0
  • Status: offline
2017/12/15 01:56:51 (permalink)
0

Time measurement of code execution

Hello
Is there a way to find out the time in which a piece of code will be executed in run time once it is flashed in the MCU using MPLABX?
#1

10 Replies Related Threads

    qɥb
    Monolothic Member
    • Total Posts : 2977
    • Reward points : 0
    • Joined: 2017/09/09 05:07:30
    • Location: Jupiter
    • Status: online
    Re: Time measurement of code execution 2017/12/15 02:00:27 (permalink)
    0
    Which PIC?
    What language (ASM? C?)
     
    The more information you leave out, the harder it is to help.
     

    This forum is mis-configured so it only works correctly if you access it via https protocol.
    The Microchip website links to it using http protocol. Will they ever catch on?
    PicForum "it just works"
    #2
    naeem1234
    Super Member
    • Total Posts : 362
    • Reward points : 0
    • Joined: 2015/02/19 06:39:28
    • Location: 0
    • Status: offline
    Re: Time measurement of code execution 2017/12/15 02:40:31 (permalink)
    0
    qɥb
    Which PIC?
    What language (ASM? C?)

     
    Sorry, my device is PIC18F46K22 and using XC8 compiler.
    #3
    qɥb
    Monolothic Member
    • Total Posts : 2977
    • Reward points : 0
    • Joined: 2017/09/09 05:07:30
    • Location: Jupiter
    • Status: online
    Re: Time measurement of code execution 2017/12/15 03:28:48 (permalink)
    0
    You can look at the LST file output by the compiler, and count assembler instructions,
    or use the simulator to run between two breakpoints,
    or use a digital scope, and pulse a spare pin high at the start and low at the end of the code you want to time.

    This forum is mis-configured so it only works correctly if you access it via https protocol.
    The Microchip website links to it using http protocol. Will they ever catch on?
    PicForum "it just works"
    #4
    naeem1234
    Super Member
    • Total Posts : 362
    • Reward points : 0
    • Joined: 2015/02/19 06:39:28
    • Location: 0
    • Status: offline
    Re: Time measurement of code execution 2017/12/15 03:54:34 (permalink)
    0
    qɥb
    You can look at the LST file output by the compiler, and count assembler instructions,
    or use the simulator to run between two breakpoints,
    or use a digital scope, and pulse a spare pin high at the start and low at the end of the code you want to time.




     
    Thanks a lot.
     
    BTW is there a way to use PICKit3 for this purpose?
    #5
    NorthGuy
    Super Member
    • Total Posts : 4931
    • Reward points : 0
    • Joined: 2014/02/23 14:23:23
    • Location: Northern Canada
    • Status: offline
    Re: Time measurement of code execution 2017/12/15 07:42:02 (permalink)
    0
    naeem1234
    BTW is there a way to use PICKit3 for this purpose?



    No. But if you can build a pulse-width measurement device using a 50-cent PIC and LCD (or $1 PIC and USB).
    #6
    HowardH
    Super Member
    • Total Posts : 794
    • Reward points : 0
    • Joined: 2006/01/20 10:21:24
    • Location: Microchip Technology - Chandler, AZ
    • Status: offline
    Re: Time measurement of code execution 2018/03/12 16:26:03 (permalink)
    +2 (2)
    The MPLAB ICD 3, MPLAB PICkit 3/4 and MPLAB REAL ICE have a stopwatch feature.  When you set two breakpoints, you can measure the cycles between them.
     
    Regards,
    Howard
    post edited by HowardH - 2018/03/12 16:36:57
    #7
    NKurzman
    A Guy on the Net
    • Total Posts : 16030
    • Reward points : 0
    • Joined: 2008/01/16 19:33:48
    • Location: 0
    • Status: online
    Re: Time measurement of code execution 2018/03/12 16:51:10 (permalink)
    +1 (1)
    1. set a pin high when you start the code, and low when it is done.  Connect the Pin to a scope.
    2. Use a Hardware timer and time the code.  you can transmit it or save it and read it with the Pickit.
    3. what the other posters already said.
     
     
    #8
    naeem1234
    Super Member
    • Total Posts : 362
    • Reward points : 0
    • Joined: 2015/02/19 06:39:28
    • Location: 0
    • Status: offline
    Re: Time measurement of code execution 2018/03/13 08:45:10 (permalink)
    0
    HowardH
    The MPLAB ICD 3, MPLAB PICkit 3/4 and MPLAB REAL ICE have a stopwatch feature.  When you set two breakpoints, you can measure the cycles between them.
     
    Regards,
    Howard




    I have only used PICKit3 for flashing .hex files but not for the purpose as you mentioned above.
    Can you point me to some document which explains how to use PICKit3 as you mentioned above?
    #9
    1and0
    Access is Denied
    • Total Posts : 8137
    • Reward points : 0
    • Joined: 2007/05/06 12:03:20
    • Location: Harry's Gray Matter
    • Status: offline
    Re: Time measurement of code execution 2018/03/13 08:54:45 (permalink)
    +2 (2)
    Have you tried searching for "stopwatch" in the IDE Help?
     
    #10
    NKurzman
    A Guy on the Net
    • Total Posts : 16030
    • Reward points : 0
    • Joined: 2008/01/16 19:33:48
    • Location: 0
    • Status: online
    Re: Time measurement of code execution 2018/03/13 11:55:43 (permalink)
    0
    I think this thread has gone Zombie.
    #11
    Jump to:
    © 2018 APG vNext Commercial Version 4.5