pic18f4550 usb configuration xc8 compiler

Discussion in 'The Projects Forum' started by embpic, Mar 19, 2014.

  1. embpic

    Thread Starter Member

    May 29, 2013
    187
    3
    i am using pic18f4550 pic controller and mplab ide, xc8 compiler. i am getting problem while configuring USB register's.
    actually i am looking for HID type communication for controlling controller action using from PC and transfer some kinda of like logged
    data to PC and may be need to send parameter to controller.So, i need HID communication.
    i read data-sheet but not clear. so my basic questions are
    1. how to make use of USB RAM and where it is used normally?
    2. what is ping pong buffer?
     
  2. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    7,386
    1,605
    Go to Microchip's website and seek out their MLA (MIcrochip Libraries for Applications).

    Download it and look thru the sample apps. They have many USB projects ready to go.

    Pick one that seems the closest to your needs, then study it to adapt it to perfection.

    (Coding your own USB controller code is a path to madness.)
     
  3. embpic

    Thread Starter Member

    May 29, 2013
    187
    3
    Thank you sir but in their library much more files are there.really get confuse.
     
  4. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    7,386
    1,605
    Look in the USB folder then pick something that looks close to your needs.
     
  5. embpic

    Thread Starter Member

    May 29, 2013
    187
    3
    i have got usb program from 18f4550.com which is in c18 compiler with description but i wanna transport it to xc8 compiler.
    so here i am getting problems. What is to use in xc8 instead of following lines which are giving error.
    #pragma udata USB_VARS
    #pragma udata // end of #pragma udata USB_VARS
    #pragma romdata // USB device descriptors
    #pragma udata USB_BDT = 0x400 // see linker script, usb4: 0x400 - 0x4FF (256 byte)
    rom
    #pragma code
    here is the link
    http://18f4550.com/updated_USB_demo_board/updated_USB_demo_board.html
     
  6. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    7,386
    1,605
    I would strongly suggest you use the same compiler as the project was built in, least you spend the next three years asking for help on hundreds of compilation errors.

    Just get the C18 compiler.
     
  7. embpic

    Thread Starter Member

    May 29, 2013
    187
    3
    yes sir i have decidede same.
    but how to use rom, udata, idata, code memory in xc8 compiler.
     
  8. Ian Rogers

    Member

    Dec 12, 2012
    158
    29
    Idata and Udata are the same... The difference is the way the compiler stores the data..

    The banks in a pic have to be managed... XC8 does it so much better than C18... This is why you need to understand the linker script..

    Each bank can be used as a separate memory location or you can group banks together... Idata is Initialised data and Udata is Un-Initialised data

    So if you declare a variable

    unsigned long var1; It is un-initailised..
    unsigned long var2 = 0; Is initialised..

    C18 will place these two variables in different banks, unless you intervene..

    Rom data is the same as the rom data on XC8..

    Your best plan is to find a few examples on the net to help you...
     
Loading...