[ILUG] Serial Port programming

Philip Trickett philipt at informatic.ie
Tue Apr 20 16:34:43 IST 1999


Hi, Just a quick question.

I am trying to use the serial port to access a device, and the device is
designed to draw power from the RTS and DTR lines.

In my program I assert them with the syntax:

   /* Assert RTS for +ve supply, clear DTR for Negative */
   tcflush(pico_portFD, TCIFLUSH);
   par = TIOCM_RTS;  ioctl (fd, TIOCMBIS, &par);
   par = TIOCM_DTR;  ioctl (fd, TIOCMBIC, &par);

   tcsetattr(pico_portFD, TCSANOW, &new_pico_termios);

   opened = TRUE;

If I compile and run this, the bits will only get set properly after I use the pre-written driver software in windows, and then reboot.

Could someone tell me whether this is the correct way to implement these features.

I presume the ioctl takes effect immediately, or does it only take effect when tcsetattr() is called?

Thanks,

Phil







More information about the ILUG mailing list