Chapter 6 Applied Instructions Example 3 The mode in D 2 is 2 (the data received ends with a specific character.) and you set the mode of sending and receiving data to 8-bit mode (SM106=ON). 1. Set the length of the data to be sent: D20=0, meaning the PLC will not send data but only receives data. 2. Set D10=16#0002 (mode: 2), D11=16#000A (the ending character is 16#0A). 3. Enable the contact X0.0. 4. The PLC waits to receive data from the external equipment. D20=0 means that the PLC does not send data to the external equipment. 5. The external equipment sends data to the PLC. External equipment → PLC 31 32 33 34 35 0A. 6. D200=6 (number the data received), the content of data received:
D201=16#0031, D202=16#0032, D203=16#0033, D201=16#0034, D202=16#0035, D203=16#000A 6_ 7. SM100=ON: reception of data is complete. 8. To send more data, set the flag SM100 to OFF to start the operation again. NOTE: When the sending of data is complete, the receiving flag SM98 is ON and then the PLC starts receiving data until receiving the ending character (16#0A). When the reception of data is complete, SM100 is ON. If the communication timeout occurs but the ending character (16#0A) is still not received, the communication timeout flag SM104 is ON. 6-571