Controlling serial port RTS pin from 'C' program
Using Slackware 9 running on a 586 Compaq laptop.
I'm using /dev/ttyS0 to communicate with a micro-controller. Opening it with O_RDWR | O_NOCTTY then using tcgetattr and so forth per the serial_programming HOWTO works fine, up to a point... I can send and receive bytes all day using a direct serial cable, however I have a half duplex radio link that I need to switch directions using the RTS line. Said another way, I need to assert RTS to low under program control before I send bytes (to turn on the radio transmitter). I've tried: int flags; ioctl(fd, TIOCMGET, &flags); flags &= ~ 0x004 // because TIOMC_RTS is undefined in my system ioctl(fd, TIOMSET, &flags); and also: ioctl(fd, TIOMBIC, 0X004); Neither seem to affect the RTS pin at all and sometimes hang the system. Any ideas? |
Well, I guess no one has a clue.
I'm able to control the UART by directly changing its registers with outb(). I'd rather not have to run the application as root though. o'well... :( |
All times are GMT -5. The time now is 09:51 AM. |