MPLAB X disassembly listing?

Status
Not open for further replies.

Pommie

Well-Known Member
Most Helpful Member
I have the following code in a project,
Code:
void interrupt high_priority ccp2(void){
    if(CCP2IF==1){
        if(CCP2M0==1){
            //pin has just gone low so do delay
            CCP2M0=0;
            CCPR2+=20000-ServoPos;
        }else{
            CCP2M0=1;
            CCPR2+=ServoPos;
        }
        CCP2IF=0;
    }
}
It's just an interrupt driven servo output.

I wanted to see the actual code produced and so opened the disassembly listing.
This is what I saw,

Now the line, CCPR2+=20000-ServoPos can't compile to one line MOVLW 0x20.

So, does anyone know how to get MPLAB X to show all the generated code?

Thanks,

Mike.
 
This is the optimized code!!

If servopos isn't being used fully yet, ie... if you set it to an initial position, and then don't use it, then it will evaluate it as a constant and two constants make one constant....


turn off optimization to view the generated code..
 
OK, how does CCPR2+=20000-ServoPos get optimized to MOVLW 0x20?

Plus, I'm using the free version that has all optimization off.

Mike.
 
You have problems with your disassembly because addresses from 148E to 14B4 are missing.
 
Mike... What compiler are you using and what chip? I'll do the same here and see what gives..
 
I'm using XC8, 18F2620 and I do change ServoPos. The weird thing is that the low level interrupt appears to be correct.

Mike - K8LH ,
I suspect the code is between 148C and 14B4 but I can't seem to get it to show me the code.

Mike.
 
I'll bring up one of my XC8 projects and take a closer look.

If you're disappointed now, wait until you see the code generated from something as simple as a TRISA = 1<<RA1; statement.
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…