PDA

View Full Version : usb code help



cluster
- 15th October 2011, 20:52
hello
i want to write a code in high memory of pic18f4550 so i modified the pbppic18.lib file and changed ORG RESET_ORG + 8 to ORG 27040 as explained in this post: http://www.picbasic.co.uk/forum/showthread.php?t=4498&p=24622#post24622
now i created a simple program as below, it worked and i am able to write this code in high memory of 18f4550 starting from 27040(69A0H)



define LOADER_USED 1
DEFINE OSC 48
adcon1 = 15

@GOTO 0x0040


however the below code does not care about DEFINE LOADER_USED 1 parameter and i am unable to program it on my defined location.


define LOADER_USED 1
DEFINE OSC 48
adcon1 = 15

;--- Setup Interrupts ------------------------------------------------------
INCLUDE "DT_INTS-18.bas" ; Base Interrupt System

ASM
INT_LIST macro ; IntSource, Label, Type, ResetFlag?
INT_Handler USB_Handler
endm
INT_CREATE ; Creates the interrupt processor
endasm

;--- Setup USB -------------------------------------------------------------
INCLUDE "DT_HID260.pbp"

DEFINE USB_VENDORID 6017
DEFINE USB_PRODUCTID 2000
DEFINE USB_VERSION 1
DEFINE USB_VENDORNAME "TEST DEVICE"
DEFINE USB_PRODUCTNAME "TEST DEIVCE"
DEFINE USB_SERIAL "001"
DEFINE USB_INSIZE 64;32 ; IN report is PIC to PC (8,16,32,64)
DEFINE USB_OUTSIZE 64;16 ; OUT report is PC to PIC
DEFINE USB_POLLIN 10 ; Polling times in mS, MIN=1 MAX=10
DEFINE USB_POLLOUT 10

; --- Each USB LED is optional, comment them if not used ----
DEFINE USB_LEDPOLARITY 1 ; LED ON State [0 or 1] (default = 1)
DEFINE USB_PLUGGEDLED PORTB,0 ; LED indicates if USB is connected
DEFINE USB_TXLED PORTC,2 ; " " data being sent to PC
DEFINE USB_RXLED PORTC,1 ; " " data being received from PC

main:
@ ON_USBRX_GOSUB _HandleRX
pause 10
goto main

HandleRX:
if USBRXBuffer[1] == "S" then
@GOTO 0x0040
else
ARRAYWRITE USBTXBuffer,[STR USBRXBuffer\USBBufferSizeRX]
GOSUB DoUSBOut
endif
return


can any one tell me why the first program is considering the define LOADER_USED 1 parameter and the second one is ignoring it.
thanks