| Torello 
 
 
 Joined: 29 Sep 2006
 Posts: 128
 
 
 
			    
 
 | 
			
				| restart_cause() |  
				|  Posted: Sun Jan 24, 2010 6:39 am |   |  
				| 
 |  
				| Hi, 
 Looking at the compiled asm (pic18lf8627) of CCS restart_cause()
 function. I don't understand several instructions. Can anyone fill in?
 My comment behind asm.
 Why setting status bits negative and OV?
 Did CCS forget the Stack reboot causes?
 
 Kind regards,
 Edwin
 PCWHD 4.103 / windows 7
 
  	  | Code: |  	  | 006F8:  MOVF   FD0,W    // get RCON
 006FA:  ANDLW  0F        // Copy upper 4 bits,  not RI !
 006FC:  BTFSS  FD0.4    //  test the RI (reset) flag ..
 006FE:  MOVLW  00        //  and clear W if RI is set (reset instruction reboot)
 00700:  BSF    FD0.0    //set BOR
 00702:  BSF    FD0.1    //set POR
 00704:  BSF    FD0.4    //Set RI
 00706:  BSF    FD8.3    //Set Status reg bit OV (flag result overflow.. why?)
 00708:  BSF    FD8.4    //Set Status reg bit N (flag result negative.. why?)
 0070A:  MOVLB  1
 0070C:  MOVWF  xCC
 
 | 
 |  |