Moxa W321-LX [75/80] Relay output w341 only

Moxa W321-LX [75/80] Relay output w341 only
W321/341 Linux Programmer's Guide
6-12
// 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))) / Target Baud Rate * 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.
Relay Output (W341 only)
The W341 uses a DO (digital ouput) for relay output. Programming with the following API allows you to change
the state of the digital output and to get the current state of the digital output.
Example
Description: The program indicates how to control DO.
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#define IOCTL_SET_DOUT 15
typedef struct _DGTIO
{
int port;
int data;
} DGTIO;
int main(void)
{
int fd = open("/dev/relay_do", O_WRONLY);
int ret = 0;
DGTIO dio;
if (fd == -1) {
perror("open relay DO device failed");

Содержание

Похожие устройства

Скачать
Случайные обсуждения