If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below. ** If you are logged in, most ads will not be displayed. **

Once you have your USB-Serial dongle, plug it into your USB port. Open a terminal and type:

Code:

ls /dev/ttyUSB*

If you see the output "/dev/ttyUSB0" or something like it, then your system is ready to use the USB-Serial interface.

To use the serial interface, you need the "cu" program ("cu" means "call-up"). In debian systems, to install the suite of tools including "cu" just type

Code:

apt-get install uucp

To use "cu", just specify the USB device and the line speed.The line speed (sometimes called "baud rate") depends on the device you are talking to. 9600, 38400, and 115200 are commonly used line speeds.

Once you have verified that "cu" is working, you can write your C program. Use the "fork()" function to start a child process, and in the child process, call the "system()" function to launch "cu": for example:

Use the pipes API to communicate between the child "cu" process and the parent process of your C program.

Emacs also has a built-in "cu" like program, so you may not need to install "cu". If you enter the emacs command "serial-term", emacs will ask you for the interface, ("/dev/ttyUSB0") and the line speed, and then give open a terminal buffer for you to communicate with your device.

Is there any solution without using USB to serial converter?

Thanks for the reply.
Actually I have a USB led lamp which changes its colour. So I wanted to write a program which can send diff data through the port,which will change the colour on the lamp. Do you have a solution for this?
Writting a program which sends raw random data through the port....

OK, I suggest using the "libusb" library. Libusb is a pretty good C language API that give you the tools to select the device from the USB device tree by its name, and then send it arbitrary data. The documentation (click here) is pretty good too.

Use your Linux's package manager to install both the library package and the C header files package.

You should check the chipset of your colour-lamp to make sure you send it data in the correct format.