256
6-3. Free communication
6-3-1
.
Free communication mode
Free format communication is data transmission in the form of data blocks, limited by the
PLC cache, the maximum amount of data sent each time is 256 bytes.
The so-called free communication, i.e. custom protocol communication, now many intelligent
devices on the market support RS232 or RS485 communication, but the protocols used by
various products are different, such as: Xinje PLC uses standard Modbus-RTU protocol, some
temperature controller manufacturers use custom protocols; if using Xinje PLC to
communicate with temperature controller, it is necessary to use free communication to send
data in full accordance with the protocol of the instrument manufacturer, so as to
communicate.
Prerequisites for free communication:
1.
Port0(RS232), Port1(RS232), Port2(RS485) or Port2-RS232(RS232) or Port2-
RS485(RS485), Port3(left extension port), Port4(upper extension port 1), Port5(upper
extension port 2) all support free communication. As the free communication needs to
change the communication parameters, port1 is not recommended.
2.
Baud rate: 300bps~3Mbps, 4.5Mbps~9Mbps (special model supported)
3.
The data format must be the same as the lower device settings. There are several options
as follows:
Data bit: 5 bits (special model supported), 6 bits (special model supported), 7 bits, 8
bits, 9 bits.
Parity bit: none, odd parity, even parity, empty, mask
Stop bit: 1 bit, 1.5 bit, 2 bits
4.
Starter: 1 byte, terminator: 1 byte
Users can set a start/termination character. After setting the start/termination character,
PLC automatically adds the start/termination character when sending data, and
automatically removes the start/termination character when receiving data.
In fact, the initiator and terminator can be regarded as the data frame head and end in
the protocol. Therefore, if the lower device communication has start and termination
character, it can be set in the software or written in the protocol.
5.
Communication mode: 8 bits, 16 bits
When 8-bit buffer is selected for communication, the high bytes of registers are invalid.
PLC only uses the low bytes of registers to send and receive data.
When 16-bit buffer is selected for communication, the PLC will send all the data of the
register, and send low-byte data first, then high-byte data.
When it is necessary to transfer low bytes and high bytes of one 16-bit register to
another 16-bit register, 16-bit buffers must be selected for communication, and the
number of communication bytes is 2. When the value stored in a 16-bit register
occupies only low bytes, we can choose 8-bit buffer to communicate. The number of
communication bytes is 1. Usually when we communicate, the data will not exceed the