Author Topic: WinUsb example, how to make Interupt driven?  (Read 14696 times)

eoin

  • Member
  • ***
  • Posts: 5
WinUsb example, how to make Interupt driven?
« 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

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: WinUsb example, how to make Interupt driven?
« Reply #1 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

eoin

  • Member
  • ***
  • Posts: 5
Re: WinUsb example, how to make Interupt driven?
« Reply #2 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?

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: WinUsb example, how to make Interupt driven?
« Reply #3 on: April 13, 2011, 09:21:24 am »
In my WinUSB example, see ReadDataViaInterruptTransfer. After receiving data, call it again.

Jan