usb code help


Closed Thread
Results 1 to 1 of 1

Thread: usb code help

  1. #1
    Join Date
    Jul 2011
    Posts
    21

    Default usb code help

    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/show...4622#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)

    Code:
    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.
    Code:
    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
    Last edited by cluster; - 15th October 2011 at 19:54.

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts