Joe, not all of what you see is executed by the PIC (really only a small portion). Here is a snippet of a .lst file. Only what is highlighted in RED are actual lines of code which find there way into the PIC:
The other colors are:Code:00000032 00472 _timeloopconst EQU 00032h 00000064 00473 _timeloopMAX EQU 00064h 00474 INCLUDE "MAIN_4.MAC" 00001 01236 LIST 00475 INCLUDE "C:\PBP\PBPPIC18.LIB" 00001 ;****************************************************************** 00002 ;* PBPPIC18.LIB * 00003 ;* * 00004 ;* By : Leonard Zerman, Jeff Schmoyer * 00005 ;* Notice : Copyright (c) 2005 microEngineering Labs, Inc. * 00006 ;* All Rights Reserved * 00007 ;* Date : 09/22/05 * 00008 ;* Version : 2.46a * 00009 ;* Notes : * 00010 ;****************************************************************** 00124 LIST 00125 ; Oscillator is 40MHz 01131 LIST 000000 01132 ORG RESET_ORG ; Reset vector at 0 01136 LIST 000000 6A1C 01137 clrf FLAGS ; Clear all flags on reset 01141 LIST 000002 EF4A F002 01142 goto INIT ; Finish initialization 01152 LIST 000008 01153 ORG RESET_ORG + 8 ; High priority interrupt vector at 8 000008 EF69 F002 01154 goto INTHAND ; Goto high priority user interrupt handler 01166 LIST 000018 01167 ORG RESET_ORG + 18h ; Low priority interrupt vector at 18h 000018 EF8F F002 01168 goto INTLHAND ; Goto low priority user interrupt handler 02164 LIST 00001C 50E9 02165 HSEROUTJ movf FSR0L, W ; Jumpman entry 02171 LIST 00001E 02172 HSEROUT 02173 CLRWDT? ; Keep Watchdog clear M ifndef NO_CLRWDT 00001E 0004 M clrwdt M endif 000020 A89E 02174 btfss PIR, TXIF ; Wait till ready 000022 D7FD 02175 bra HSEROUT 02176 02177 ifdef HSERPARITY_USED 02178 if (HSER_BITS != 9) 02179 andlw 7fh ; Clear top bit 02180 rcall HSERPARITY ; Calculate the parity 02181 ifdef HSER_ODD 02182 btfss GOP, 0 02183 else 02184 btfsc GOP, 0 02185 endif 02186 iorlw 80h ; Set parity 02187 else 02188 rcall HSERPARITY ; Calculate the parity 02189 bcf TXSTA, TX9D ; Start parity at 0 02190 ifdef HSER_ODD 02191 btfss GOP, 0 02192 else 02193 btfsc GOP, 0 02194 endif 02195 bsf TXSTA, TX9D ; Set parity in 9th bit 02196 endif 02197 endif 02198 000024 6EAD 02199 movwf TXREG ; Send the char 000026 80D8 02200 bsf STATUS, C ; Set no timeout for Serout2mod 000028 EF47 F002 02201 goto DUNN ; That's it
BLUE = Declarations, processed by assembler
ORANGE= Assembler commands, directives, macros
GREEN = Comments
PURPLE= Labels
Also, here is a little legend for the lines of code:
Code:PIC Commands ASM Commands line# in HEX line# in ASM . 000024 6EAD 02199 movwf TXREG ; Send the char 000026 80D8 02200 bsf STATUS, C ; Set no timeout for Serout2mod 000028 EF47 F002 02201 goto DUNN ; That's it EDIT: Maybe some better discriptors: PIC line# = ADDRESS in PIC program memory Commands in HEX = PIC Object Code (or OPCODE or Instruction) Commands in ASM = Source Code
Hope this helps you in your understanding of what goes on "under the hood"
SteveB





Bookmarks