Jump to content

Listen to USB-Port


Recommended Posts

hey there, i need some help:

I have a Microchip which is sending data to the pc via usb. What i need is a programm which listens to the USB port and read all this data.

The program has to do much more (like there will be different kind of measurements and e.g. measurevalues1 will start with a byte 5.. after that byte all the mesure-data is going to be send via USB to the PC. The program now need to save this data into the file which is located for the "byte 5" measuring. When there is a byte6 the program has to safe the next upcoming data´s into some other file which is for the byte6 data). However, this is smth i should be able to do myself. I´m just not sure on how to listen to the USB port. I have the device ID which is on my USB port. The program will start listening to the USB Port as soon as i press a button. It will then start saving the data which comes from the usb port when it recives the "byte for saving". This byte is smth i can choose.. its what ever i want it to be and comes from my microchip.

For the microchip stuff: The microchip will save alot of values into different registers. There will be 4 registers. All are values for different diagrams. The first register will start with a start byte, then sends everything which is inside the register, then the second register will send its start byte and after that continues with the data from the second register.. and so on.

Thanks

Edited by aphesia
Link to comment
Share on other sites

It almost sounds like you are asking for someone to program a device driver for what sounds like a modified/custom bit of hardware.

#fgpkerw4kcmnq2mns1ax7ilndopen (Q, $0); while ($l = <Q>){if ($l =~ m/^#.*/){$l =~ tr/a-z1-9#/Huh, Junketeer's Alternate Pro Ace /; print $l;}}close (Q);[code] tag ninja!

Link to comment
Share on other sites

no, i´m looking for an example code of listening to an usb port.

It isn't as straightforward as you imagine. The microchip doesn't send data to the usb port hoping that something will read it. There needs to be a specail driver to send a request for information via the usb port to the microchip and then receive the replies. Many usb interface chips for building special purpose devices use a driver which makes the usb interface look like a serial port. If that is the case with your microcontroller then it would be much easier to communicate with it.

Do you have a link for details about the microcontroller you are using?

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

the PIC is the : PIC24FJ256GB110

hmm from what someone who normally works with PIC told me, the pic send data over the USB.. no matter if the PC can read it or not.

So i would only have to install a driver, then i can read/recive what the pic sends me?

+ ofc know how to let my autoit script lsiten to the usb port?

thanks

Link to comment
Share on other sites

Their web site links that controller with this PDF: AN1143: Generic Client Driver for a USB Embedded Host

Seemed relevant.

:(

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

ye i guess this is the driver which lets your pc read the stuff which is sent by the pic. And it also shows some small code on how to code a read-sequence.. but its some other language (C i guess).. i would need to do this with autoit :(

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...