DynaGATE 10-12 User manual Rev. 0-14
11 How to access interfaces under Linux
Example: Configuring a serial port in RS-232 mode
ser_port_name
can be either
/dev/ttyO3
or
/dev/ttyO4
.
struct serial_rs485 rs485conf;
unsigned int rs_mode_mask=(SER_HIZ_ENABLED|SER_RS485_ENABLED|SER_RS485_
INVERT|SER_RS485_RTS_ON_SEND|SER_RS485_RTS_AFTER_SEND);
unsigned int set_flags=0;
unsigned int set_flags_mask=rs_mode_mask;
int fd;
fd=open(ser_port_name,O_RDWR);
if (fd==-1)
{
/* process the error */
…
}
/* get serial port configuration */
if (ioctl (fd, TIOCGRS485, & rs485conf) < 0)
{
/* process the error */
…
}
rs485conf.flags&=~ set_flags_mask;
set_flags&=set_flags_mask;
rs485conf.flags|= set_flags;
/*set delay but not used in rs232 mode */
rs485conf.delay_rts_after_send=<delay after send in ms>;
rs485conf.delay_rts_before_send=<delay before send in ms>;
/* apply changes */
if (ioctl (fd, TIOCSRS485, & rs485conf) < 0)
{
/* process the error */
…
}
close(fd);
71 / 94
Summary of Contents for DynaGate 10-12 Series
Page 10: ...This page has been intentionally left blank...
Page 12: ...This page has been intentionally left blank...
Page 14: ...This page has been intentionally left blank...
Page 16: ...This page has been intentionally left blank...
Page 22: ...This page has been intentionally left blank...
Page 28: ...This page has been intentionally left blank...
Page 60: ...This page has been intentionally left blank...
Page 62: ...This page has been intentionally left blank...
Page 82: ...This page has been intentionally left blank...
Page 88: ...This page has been intentionally left blank...
Page 90: ...This page has been intentionally left blank...
Page 92: ...This page has been intentionally left blank...
Page 93: ...DynaGATE 10 12 User manual Rev 0 14 Notes NOTES 93 94...