When building devices with USB capable microcontrollers, a quick and simple option for communicating with a host PC is to use CDC, a virtual serial port. This handy mechanism is built into all modern PC operating systems. However, the way you open a serial port, set line settings, and start speaking serial are very different between Microsoft Windows and POSIX based platforms. This library and program bridges the differences between the two APIs and supplies a console tool for making communication in scripts much simpler. CDCTool is a cross platform library and command line tool for sending and receiving short amounts of text from a serial connection. It wraps the separate Win32 and POSIX serial communications APIs into a single package. The library eases cross platform serial coding. The command line tool is useful for sending quick messages or for shell scripting. Links
Example (Windows)
Example (Linux)
UPDATE: Three new features are in the works:
UPDATE 2: Interactive mode is available in cdctool, version 0.0.3. Use the -a switch on the command line. UPDATE 3: The discovery feature is available in cdctool 0.0.5. A new command line program "cdcdiscover" and related library routines can be used to find devices. It takes two arguments, a command to send to serial ports that it finds, and a regular expression to match against the results. Example: |
|