LINUX.IE, website of the Irish Linux Users' Group
Tux rules!

   
Home
New Users
Articles
Download
Projects
Community
Vendors

  Print Version
Email to...
 
Archives:


planetILUG

Recent News

News Archive


Join the
ILUG
on FaceBook


Join the
ILUG
on LinkedIn


Join the
ILUG SETI
Group



















 
 :: Mailing Lists

[ILUG] Serial Port programming

[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
Read this without the formatting.
                                                                                                    

 

Hosted by HEAnet


Maintained by the ILUG website team. The aim of Linux.ie is to support and help commercial and private users of Linux in Ireland. You can display ILUG news in your own webpages, read backend information to find out how. Networking services kindly provided by HEAnet, server kindly donated by Dell. Linux is a trademark of Linus Torvalds, used with permission. No penguins were harmed in the production or maintenance of this highly praised website. Looking for the Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!
RSS Version
Powered by Dell