Accessing Labels From Other Modules
Labels that are defined in one module for use in other modules must be exported using the
GLOBAL
directive. Labels must be defined before they are declaredGLOBAL
. Modules that use these labels must use theEXTERN
directive to declare the existence of these labels. An example of using theGLOBAL
andEXTERN
directives is shown below.Relocatable Code, Defining Module
UDATA
InputGain RES 1
OutputGain RES 1
GLOBAL InputGain, OutputGain
CODE
Filter
GLOBAL Filter
: ; Filter code
Relocatable Code, Referencing Module
EXTERN InputGain, OutputGain, Filter
UDATA
Reading RES 1
CODE
...
MOVLW GAIN1
MOVWF InputGain
MOVLW GAIN2
MOVWF OutputGain
MOVF Reading,W
CALL Filter
Microchip Technology Inc. Microchip's Web Site Voice: (480) 792-7200 Fax: (480) 899-9210 Microchip's E-mail Address |