PORTS Forum

Ports and Interfaces => USB => Topic started by: eoin on April 12, 2011, 06:49:57 am

Title: WinUsb example, how to make Interupt driven?
Post by: eoin on April 12, 2011, 06:49:57 am
Hi there all,

I am successfully using the WinUsb example to communicate with my PIC24F using BULK. On the PIC side I receive USB data from the PC interrupt driven, but on the PC I always have to ask the PIC for data. How could I make this WinUsb code interrupt driven on the PC, ideally whenever a packet is received from the PIC I want it to jump into an event handler in my PC application.

Any ideas will be much appreciated.

EOin
Title: Re: WinUsb example, how to make Interupt driven?
Post by: Jan Axelson on April 12, 2011, 10:35:18 am
In your application, create a thread that checks for new data and interrupt the main thread when data is available.

Jan
Title: Re: WinUsb example, how to make Interupt driven?
Post by: eoin on April 13, 2011, 06:26:10 am
Ok I think I can get the piece working with the thread, but which function do i need to poll in this new Thread to check for USB data?
Title: Re: WinUsb example, how to make Interupt driven?
Post by: Jan Axelson on April 13, 2011, 09:21:24 am
In my WinUSB example, see ReadDataViaInterruptTransfer. After receiving data, call it again.

Jan