When working with the free port communication of Siemens S7-200, it's essential to configure the serial port correctly through programming. This includes setting the right mode, managing the sequence of sending and receiving commands, and defining the start and end conditions for data reception. For engineers new to this system, there are many subtle details that can lead to errors. When a customer reports a communication failure, the first step is usually to check if the configuration in the program is correct.
One particular case stood out because it was quite unexpected. The customer had written a free port communication program where the PLC could send data successfully but couldn't receive any from the other side. Since the sending function worked, it suggested that the port settings were not the issue. However, the problem likely lay elsewhere—possibly in how the receive command was being triggered or managed.
The customer claimed their program didn’t have such an issue, but we decided to test by creating a simplified version that only used the RCV instruction. Even then, no data was received, and the monitor showed that the RCV instruction executed normally. This made us question whether the initial conditions for receiving were set up incorrectly.
We checked the use of the start character, which was correct, and even tried switching to idle line detection, but the issue remained. Could it be an issue with the signal sent by the other party? We tested using serial debugging software, and the signals were received without issues. None of the common mistakes seemed to apply here.
After going through all possibilities without success, I asked the customer to share the actual program. At first glance, I didn’t see the problem. But once I looked closer, it became clear: the customer had configured the maximum number of characters to be received incorrectly. They set SMW94 (which holds the high byte) to 0 and SMW95 (the low byte) to 100. In Siemens PLCs, the high byte comes first, so assigning 100 to the low byte meant the actual maximum number of characters was zero. That explained why no data was being received at all.
Aspheric Lens,Standard Aspheric Lens,Positive Meniscus Lenses,High Precision Aspheric Lens
Danyang Horse Optical Co., Ltd , https://www.dyhorseoptical.com