pic18f4550 usb configuration xc8 compiler

Thread Starter

embpic

Joined May 29, 2013
189
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?
 

ErnieM

Joined Apr 24, 2011
8,377
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.)
 

Thread Starter

embpic

Joined May 29, 2013
189
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
 

Ian Rogers

Joined Dec 12, 2012
1,136
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...
 
Top