FAQFAQ   GalleryGallery   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in   Forum RSS Feed   Hacked Gadgets Main Site 

use PIC18F4550 USB DEMO amend application routine

 
Post new topic   Reply to topic    Hacked Gadgets Forum Index -> Electronic Resources
View previous topic :: View next topic  
Author Message
bavrpic
Newbie


Joined: 25 Apr 2008
Posts: 2

PostPosted: Sat May 03, 2008 8:48 pm    Post subject: use PIC18F4550 USB DEMO amend application routine Reply with quote

/**********************USB data manage*****************/
void ProcessIO(void)
{
//BlinkUSBStatus();
// User Application USB tasks
if((usb_device_state < CONFIGURED_STATE)||(UCONbits.SUSPND==1)) return;
if(USBGenRead((byte*)&dataPacket,sizeof(dataPacket)))

{
x1=dataPacket.CMD;
while(x<x1)
{
USBTasks(); // USB Task
ServiceRequests();
}
if(x=x1){x=0;}
}
}//end ProcessIO

void ServiceRequests(void)
{
counter = 4;

if(!mUSBGenTxIsBusy())
{
x++;
USBGenWrite((byte*)&x,counter); }
Delay100TCYx(50);

}//end ServiceRequests

PIC18F4550 fireware design:

① main.c:include InitializeSystem() and USBTasks(void),complement the initializaton and the subprogram's transfer.

② usb9.c:USBCheckStdRequest(void)、USBStdGetDscHandler(void) and USBStdFeatureReqHandler(void).

③ usbctrltrf.c:complement transmission function,USBCtrlTrfSetupHandler(void)、USBCtr-lEPServiceComplete(void) and USBPrepareForNextSetup-Trf(void).

④ usbdrv.c:USBSuspend(void)、USBModuleEnable(void)、USBSoftDetach(void)和USBDriverService(void).

⑤ usbdsc.c:describe the system,manufacturer,product.

⑥ usbgen.c:USBGenInitEP(void)、USBGenRead(byte*buffer,byte len) and USBGenWrite(byte*buffer,bytelen).

⑦ usbmmap.c:detect the compatible between BDT and port.

⑧ user.c:make the consumer complete their
initialization,read,wirte,displsal of I/O,and the request of device. UserInit(void)、BlinkUSBStatus(void)、ServiceRequests(void)、ProcessIO(void)、ResetTempLog(void) and ReadPOT(void).
Back to top
View user's profile Send private message

Display posts from previous:   
Post new topic   Reply to topic    Hacked Gadgets Forum Index -> Electronic Resources All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



Powered by phpBB © 2001, 2005 phpBB Group