Communication by PLC program
Initialization
Initialize the module before sending or receiving data for the first time.
Procedure:
- 1. Set “Init request” to 1
- The module confirms successful initialization by setting “Init accepted”.
- 2. Reset “Init request”
- The module sets “Init accepted” to 0.
- The module is ready for data exchange.
Sending data
- 1. Write the data to be transmitted to the Data Out [n] output variables.
- 2. In the Control word, set the Output Length parameter to the number of bytes to be transmitted.
- 3. Toggle the Transmit Request bit in the Control word.
- The module acknowledges the data transmission in the Status word via the Transmit Accepted parameter.
Receiving data
If the module toggles the Receive Request bit in the Status word, new receive data are available in the process data.
- 1. Read the Input Length parameter from the Status word. It contains the number of bytes to be received.
- The data are located in the input variables Data In [n]. The first datum received is stored in Data In 0.
- 2. After reading the data, acknowledge this by toggling the Receive Accepted bit in the Control word.
The module only transfers new data from the receive buffer to the process data after this.
Prioritization
Since received data normally cannot be repeated by the transmitter, they have a higher priority in the module than data to be transmitted.
Furthermore, the priority decreases as the channel number increases. Hence, the reception of data on channel 1 has the highest priority.
Further Information