View previous topic :: View next topic |
Author |
Message |
vsmguy
Joined: 13 Jan 2007 Posts: 91
|
Counting number of instructions in CCS C |
Posted: Sat Jul 10, 2010 11:25 am |
|
|
I would like to find out, *without* opening the assembly listing, the number of instructions for a line ( or a number of lines ) in CCS C.
Is this possible ( even in conjuction with tools like MPLAB using the plugin )?
For example,
1. I want to find out how many instructions
generates
2. I want to find out how many instructions
Code: | set_timer1(0);
delay_us(200);
|
generates
3. Then, I would like to count the number of clock cycles it took to execute each function, *without* opening the assembly listing |
|
![](templates/subSilver/images/spacer.gif) |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
![](templates/subSilver/images/spacer.gif) |
vsmguy
Joined: 13 Jan 2007 Posts: 91
|
|
Posted: Sat Jul 10, 2010 6:41 pm |
|
|
YES!
I remember doing this a long time ago - and it required a little bit of fiddling around - can't seem to find those instructions.
Now, thanks to you - oh great Midrange PIC Programmer, I found them once again :-D |
|
![](templates/subSilver/images/spacer.gif) |
vsmguy
Joined: 13 Jan 2007 Posts: 91
|
|
Posted: Mon Jul 12, 2010 7:29 pm |
|
|
One more question - how do I do the same *but* between two lines in assembly generated by CCS?
For example, say I have written a function called func() that generates the following assembly:
0011: MOVLW 26
0012: MOVWF 04
0013: BCF 03.7
0014: MOVF 00,W
I want to find out how many cycles it takes between lines 11 and 13 - how do I do that? |
|
![](templates/subSilver/images/spacer.gif) |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Mon Jul 12, 2010 8:29 pm |
|
|
Look it up in the PIC data sheet. For example, for the 18F452, look in
this section:
Quote: |
TABLE 20-2: PIC18FXXX INSTRUCTION SET
|
It lists the number of cycles used by each type of instruction.
Just count them off in the .LST file. |
|
![](templates/subSilver/images/spacer.gif) |
vsmguy
Joined: 13 Jan 2007 Posts: 91
|
|
Posted: Mon Jul 12, 2010 9:56 pm |
|
|
PCM programmer wrote: | Look it up in the PIC data sheet. For example, for the 18F452, look in
this section:
Quote: |
TABLE 20-2: PIC18FXXX INSTRUCTION SET
|
It lists the number of cycles used by each type of instruction.
Just count them off in the .LST file. |
That's what I am doing manually now and it's kinda time consuming for longwinded and involved code ( look at my latest post on delay_us inaccuracy ).
The MPLAB Stopwatch seems to be language independent and and counts the number of ticks.
I was asking if there is anyway I could get it to count ticks by setting breakpoints in the assembly code generated by CCS? |
|
![](templates/subSilver/images/spacer.gif) |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Mon Jul 12, 2010 10:16 pm |
|
|
Start exploring MPLAB. Go to the View menu. Bring up the Disassembly
Listing window. Put your breakpoints in there. Explore the program.
Read the Help file. |
|
![](templates/subSilver/images/spacer.gif) |
vsmguy
Joined: 13 Jan 2007 Posts: 91
|
|
Posted: Mon Jul 12, 2010 10:39 pm |
|
|
PCM programmer wrote: | Start exploring MPLAB. Go to the View menu. Bring up the Disassembly
Listing window. Put your breakpoints in there. Explore the program. |
That's it. Thanks again.
PCM programmer wrote: | Read the Help file. |
I should :'( |
|
![](templates/subSilver/images/spacer.gif) |
|