10 How to Access the Interfaces Under Linux
BoltGATE 20-25 User Manual Rev. 1-1
Example: Configuring a serial port in RS-485 mode
ser_port_name
can be either
/dev/APP0
or
/dev/APP1
.
struct serial_rs485 rs485conf;
rs485conf.flags=ETH_SER_MODE_RS485
//INSERT THE TERMINATION
rs485conf.flags|=ETH_SER_PORT_TERM
//INSERT CHARACTERS DELAY AFTER SEND
rs485conf.flags|=ETH_SET_RS485_DELAY
rs485conf.delay_rts_after_send=10
int fd;
fd=open(ser_port_name,O_RDWR);
if (fd==-1)
{
/* process the error */
…
}
/* apply changes */
if (ioctl (fd, TIOCSRS485, & rs485conf) < 0)
{
/* process the error */
…
}
close(fd);
10.7.2
How to Test a Serial Port
To test the serial port, use the microcom utility:
#connect ttyCOM1 with a baud rate of 9600
microcom /dev/ttyCOM1 –s 9600
The microcom utility:
l
Allows you to transmit/receive data to/from the serial port
l
Does not include a local echo (you cannot see the sent data).
76 / 102
Содержание BoltGATE 20-25
Страница 4: ...This page has been intentionally left blank...
Страница 12: ...This page has been intentionally left blank...
Страница 14: ...This page has been intentionally left blank...
Страница 16: ...This page has been intentionally left blank...
Страница 24: ...This page has been intentionally left blank...
Страница 48: ...This page has been intentionally left blank...
Страница 66: ...This page has been intentionally left blank...
Страница 86: ...This page has been intentionally left blank...
Страница 92: ...This page has been intentionally left blank...
Страница 94: ...This page has been intentionally left blank...
Страница 98: ...This page has been intentionally left blank...
Страница 101: ...BoltGATE 20 25 User Manual Rev 1 1 Notes NOTES 101 102...