Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

usb device communication with my pc

Status
Not open for further replies.

defcon31

New Member
hello,

what i wanna try to do is: when i connect my own device to pc (via USB), instead of polling (which asks a lot of processor speed of my pc), isnt there a possibility to let my device generate interrupts to my pc so that my pc only does a specific action only when the interrupt (or whatelse) is given. Programming my microcontroller will not be a problem, but how about on PC-side ?

i know that with a serial port this is possible, but with usb ???

but it has to be possible because image an usb mouse; i cannot imagine that my pc polls constantly to my mouse if movement happened... it must be the mouse that generates an interrupt (or whatever) itself.

think i will have to write a driver for it also, or is an C++ application enough?

i have searched already a lot on the internet, but cannot find much.
can you give me some more idea's, good sites (eventually books) about what i'm trying to do?

thanks in advance
 

Nigel Goodwin

Super Moderator
Most Helpful Member
defcon31 said:
hello,

what i wanna try to do is: when i connect my own device to pc (via USB), instead of polling (which asks a lot of processor speed of my pc), isnt there a possibility to let my device generate interrupts to my pc so that my pc only does a specific action only when the interrupt (or whatelse) is given. Programming my microcontroller will not be a problem, but how about on PC-side ?

i know that with a serial port this is possible, but with usb ???

but it has to be possible because image an usb mouse; i cannot imagine that my pc polls constantly to my mouse if movement happened... it must be the mouse that generates an interrupt (or whatever) itself.

think i will have to write a driver for it also, or is an C++ application enough?

i have searched already a lot on the internet, but cannot find much.
can you give me some more idea's, good sites (eventually books) about what i'm trying to do?

thanks in advance

Check at https://www.microchip.com for information on the PIC16C745 - this is a USB compatible PIC, and MicroChip have application notes detailing it's use - including the PC side!. You can also download all the source code for their new USB FLASH programmer, again both PC and PIC sections.
 

Noggin

Member
USB on a PC is nothing put a polling device. Whatever you connect to the USB port can only respond when its spoken to. And yes, this means that your mouse on the USB port acts as a polled device.

Originally taken from **broken link removed**
The USB uses a polling protocol. Whenever the host whishes to receive data from the device it issues a token (a packet types that we will discuss later) addressed to that specific device. If the device has data to send it sends it after receiving the token and the host (if the handshake phase is included on the transfer) will respond with handshake packet. It the device doesn't have anything to send the host issues the token to the next device. If, on the other hand, the host whishes to send data to the device, it will send the appropriate token and data packet following it. The device will response by a handshake packet (if handshake phase is included). Once again, the moment the host finishes transmitting data to that device, it issues a new token to the next one.
 

defcon31

New Member
found also a good theory about the usb-standard, not too much to read, just enough...
**broken link removed**
but now i want to know how i can let my VB or C++ programs run in the most efficient way with my own usb device... (do i have to make my own driver and install this, or do i just have to write one c++ application?) searching for more examples on the net before starting developing....
 

Nigel Goodwin

Super Moderator
Most Helpful Member
defcon31 said:
found also a good theory about the usb-standard, not too much to read, just enough...
**broken link removed**
but now i want to know how i can let my VB or C++ programs run in the most efficient way with my own usb device... (do i have to make my own driver and install this, or do i just have to write one c++ application?) searching for more examples on the net before starting developing....

Have you checked MicroChip's application notes I mentioned above?, it probably tells you pretty all well you need to know. Particularly the FLASH programmer - giving away all the circuits and source code for a complete USB commercial product is extremely rare!.
 
Status
Not open for further replies.

Latest threads

Top