Hi, I want to send chains of 12 bits of data through USB, but I'm completely new to USB programming. Say I type in "A", and it'll send 000000000001 or something like that.

Basically, I'm wondering how you tell the USB port to send a 0 or a 1 in C++. I'm writing with wascana eclipse, and I'm not sure what libraries to use.

This may be helpful for you (Windows only): http://msdn.microsoft.com/en-us/library/ms810467.aspx

This may also be helpful: http://www.libusb.org/

the first link gives information for programming serial ports right?

i've downloaded the libusb package, but one question I have is if you can control every bit that goes out individually. For example,

int main(){
for(;;)}
cin >> myinput
sendToUSB(myinput);
}
}

say I input 0101, can i have a procedure that sends out all logic 0's and 1's through a void procedure (below) as defined by USB convention? (0=600microseconds, 1=1200microseconds) Basically I need help writing that void procedure.

void sendToUSB(myinput)

Edited 5 Years Ago by kchyn: n/a

the first link gives information for programming serial ports right?

i've downloaded the libusb package, but one question I have is if you can control every bit that goes out individually. For example,

int main(){
for(;;)}
cin >> myinput
sendToUSB(myinput);
}
}

say I input 0101, can i have a procedure that sends out all logic 0's and 1's through a void procedure (below) as defined by USB convention? (0=600microseconds, 1=1200microseconds) Basically I need help writing that void procedure.

void sendToUSB(myinput)

Also, the libusb specs say that you need to send a setup packet before the actual data package. It should be possible to send just a data package, without the setup packet in front of it right? I'm making a circuit that's going to interpret 12 bits which are sent out of the USB port at a time, and it'll be a lot easier if I don't have to mess around with the setup packet.

Yeah, I know about bitset. I just need help with the actual USB programming part. Is there any way of sending out data payloads without any padding?

Also, is it possible to send data do a device that I built, even if the computer does not recognize it? Because I'm pretty sure once I connect my circuit it's going to be detected and windows won't have a driver for it.

Edited 5 Years Ago by kchyn: n/a

Might have to write a driver or a mini driver.

If you're using Windows check out the DDK (Driver Development Kit). For devices like a mouse often only a mini-driver is required.

This article has been dead for over six months. Start a new discussion instead.