That is ASM syntax.
DEFINE's are just passed to LST file, after compile.
There is no direct connection between that two pice of code.
LED's are turned on/off with macro's in DT_HID260.pbp
MACROs for LED:
Code:
ASM
ifndef USB_LEDPOLARITY ; If LED polarity wasn't specified?
USB_LEDPOLARITY = 1 ; default to ON when HIGH
endif
;-------------------------------
LEDOFF macro Port, Bit ; -- Turn LED OFF --
if (USB_LEDPOLARITY == 1) ; If LED is ON when HIGH?
LOW?T Port, Bit ; make it LOW
else ; otherwise
HIGH?T Port, Bit ; make it HIGH
endif
endm
;-------------------------------
LEDON macro Port,Bit ; -- Turn LED ON --
if (USB_LEDPOLARITY == 1) ; If LED is ON when HIGH?
HIGH?T Port, Bit ; make it HIGH
else ; otherwise
LOW?T Port, Bit ; make it LOW
endif
endm
;-------------------------------
ifLEDisON macro Port,Bit, Label
if (USB_LEDPOLARITY == 1) ; if LED is ON when HIGH
btfsc Port, Bit ; and the pin is LOW
else ; or if LED is ON when LOW
btfss Port, Bit ; and the pin is HIGH
endif ; then the LED is OFF
goto Label ; so don't jump to the label
endm
;-------------------------------
ifLEDisOFF macro Port,Bit, Label
if (USB_LEDPOLARITY == 1) ; if LED is ON when HIGH
btfss Port, Bit ; and the pin is HIGH
else ; or if LED is ON when LOW
btfsc Port, Bit ; and the pin is LOW
endif ; then the LED is ON
goto Label ; so don't jump to the label
endm
ENDASM
As you can see from macros, Darrel used HIGH and LOW commands from PBP to handle BANK, TRIS, and output register of port.
To turn TX LED:
Code:
;----[Send USB data]--------------------------------------------------------
DoUSBOut:
ASM
ifdef USB_TXLED
LEDON USB_TXLED
endif
ENDASM
....
He call LED macro from DoUSBOut subrutine...
Code:
DoUSBService:
INTS_FROM = INTS_FROM | UIR
ASM
ifdef USB_ServiceLED
LEDON USB_ServiceLED
endif
ENDASM
etc...
Bookmarks