ThinkCore W311/321/341 Linux User’s Manual Programmer’s Guide
6-8
if ( (term.c_cflag & (CBAUD|CBAUDEX)) != B4000000 ) {
// follow the standard termios baud rate define
} else {
ioctl(fd, MOXA_GET_SPECIAL_BAUD_RATE, &speed);
}
Baudrate inaccuracy
Divisor = 921600/Target Baud Rate. (Only Integer part)
ENUM = 8 * (921600/Targer - Divisor) ( Round up or down)
Inaccuracy = (Target Baud Rate – 921600/(Divisor + (ENUM/8))) * 100%
E.g.,
To calculate 500000 bps
Divisor = 1, ENUM = 7,
Inaccuracy = 1.7%
*The Inaccuracy should less than 2% for work reliably.
Special Note
1. If the target baudrate is not a special baudrate (e.g. 50, 75, 110, 134, 150, 200, 300, 600, 1200,
1800, 2400, 4800, 9600, 19200, 38400, 57600, 115200, 230400, 460800, 921600), the termios
cflag will be set to the same flag.
2. If you use stty to get the serial information, you will get speed equal to 0.
DO
Using Dout pin 22 to control Dout close nad open , if make Pin 22 pull high being closed and
Pin22 pull low being open.
Usage like:
echo “22 1 1” > /proc/driver/dio Î The Do will be open
echo “22 1 0” > /proc/driver/dio Î The Do will be close