RS-422/485 communication sample program
・The following files are created by executing make.
./serial, ./serial.o
Example 1) Perform full duplex communication self-loop of RS-422/485.(BX-220 Series, BX-830 Series)
$ ./serial
* Please refer to the wiring diagram below and create cable for self loop.

Note)
This is a sample program that performs RS-422/485 full duplex communication self loop.
It is created on Linux assumption to recognize it as /dev/ttyS2.
When device recognition is different, please correct it after modifying the sample source code according to the recognition situation.
The interrupt configuration of the RS-422/485 communication port is IRQ7 (fixed) in the BIOS.
The device cannot share interrupts.
On the other hand, Linux initially sets IRQ7 to interrupt sharing with other devices.
During RS-422/485 communication, interrupt may not occur when interrupt sharing is necessary,
resulting in communication failure. In order to avoid this, reassign the IRQ assignment from 7 to 4.
$ apt-get install setserial
$ setserial /dev/ttyS2 irq 4
Example 2) Perform full duplex communication self-loop of RS-422/485.(BX-825 Series, BX-T210 Series, BX-M1500 Series, BX-M2500 Series, BX-T3000 Series, PT-M1xSA-210 Series, BX-T310-J Series, BX-M310-J Series, PT-MxxWA-310/PT-FxxSA-320 Series)
$ ./serial
* Please refer to the wiring diagram below and create cable for self loop.

Note)
This is a sample program that performs RS-422/485 full duplex communication self loop.
It is created on Linux assumption to recognize it as /dev/ttyS0.
When device recognition is different, please correct it after modifying the sample source code according to the recognition situation.
Please set "RS-422 Full Duplex" in BIOS beforehand.