View previous topic :: View next topic |
Author |
Message |
hamid9543
Joined: 31 Jan 2013 Posts: 63
|
measure execution time |
Posted: Sat Jan 19, 2019 11:05 am |
|
|
I am trying to find the best way to measure execution time of a specific section of code.
is there any function ? |
|
|
dluu13
Joined: 28 Sep 2018 Posts: 395 Location: Toronto, ON
|
|
Posted: Sat Jan 19, 2019 11:34 am |
|
|
Something I've done is to output high to a pin before the code and low after. Use an oscilloscope to capture the pulse on that pin, and use the cursor. |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9243 Location: Greensville,Ontario
|
|
Posted: Sat Jan 19, 2019 11:49 am |
|
|
best way ?
we all have OUR 'best way'...
I prefer to dump the listing, highlight the 'specific section of code', referenece the PIC's instruction set and then calculate the time. With 'lower end' PICs, a 4MHz xtal gives a 1us execute time per most instructions. Easy to recallculate for say a 20MHz xtal, the time will be 5 times faster.
The scope method will work but depends on how good($$$) a scope you have and IF if has been calibrated !!
Jay |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
|
|