Arizona Picdem 17 User Manual

Page of 92
PICDEM™ 17 Demonstration Board User’s Guide
DS39024B-page 26
 2001 Microchip Technology Inc.
4.4
 Startup Code File
The startup code file is used to call the startup function (if enabled), initialize 
data routine (if enabled), initialize the stack, and then branch to the main 
function. This file would need to be assembled and linked in with the other 
files in the project.
;*****************************************************************
;**    PIC17Cxx MPLAB C v2.0 Assembly Startup File, Version 1.10  
;**               L a r g e    M o d e l                          
;**     PICDEM 17 Workshop Demo Board Version                     
;**    (c) Copyright 1997 Microchip Technology                    
;*****************************************************************
; This is the C startup assembly file for the large model. Please
; refer to chapter 3 in the user’s guide for more information.
; The following two statements determine whether you wish to use
; initialized data in your C programs and whether you wish to
; have a __STARTUP() function called upon reset. Please note that
; if you turn USE_STARTUP on, then you must defined a __STARTUP()
; in your code or you will get a linker error.
; #DEFINE USE_INITDATA      ;Uncomment if you use initialized data
; #DEFINE USE_STARTUP       ;Uncomment if you use __STARTUP()
;--------------------- E Q U A T E S -----------------------;
PCL        equ     0x02
PCLATH     equ     0x03
;----------------External variables and labels--------------;
   EXTERN  _stack
   EXTERN  main
#IFDEF  USE_STARTUP
   EXTERN  __STARTUP
#ENDIF
#IFDEF  USE_INITDATA
   EXTERN  copy_init_data
#ENDIF
;***********************************************************;
RESET  CODE  H’4000’    ;Location of reset vector
;-----------------------------------------------------------;
;
;-----------------------------------------------------------;
; Optionally call __STARTUP()                               ;
;-----------------------------------------------------------;
#IFDEF  USE_STARTUP
  movlw  HIGH __STARTUP
  movwf  PCLATH
  lcall  __STARTUP
#ENDIF
;-----------------------------------------------------------;
; Branch to startup code                                    ;
;-----------------------------------------------------------;