Serial to ethernet converter transfer serial data to TCP/IP data, whilst largely shortening the distance of transfer. As the application of serial to ethernet converter is wider and wider, there came many small problems in practical use. Now, we are going to explain how to solve messy code when receiving data with serial to ethernet converter.
It is uncommon to have messy code, and this situation generally results from following three reasons.
First is the incorrect setting of baud rate and the inconsistence of digit bit and vertification bit, that is, baud rate of serial to ethernet converter is inconsistent with serial device. To solve this problem, you only need to set the baud rate of server to be the same as that of device.
Second is the incorrect of data format. Commonly, serial to ethernet converter sends data in hex format. If the format is incorrect, it will not have messy code. To solve this problem, you need to receive data in hex format.
The third reason is the problem of hardware. Generally, RS232 and RS 485 are of different electrical levels so they cannot be connected directly. It needs to use 232c clip or 485 clip to transfer in the process of usage.
Users usually connect TTL electrical level to computer directly, which will definitely lead to messy code. In addition, improper design of hardware may also disturb the communication. You only need to check hardware carefully.
If the reason for messy code can not be identified through the three methods above, you may communicate device with computer directly in the light of baud rate related setting to see whether it can work normally and confirm whether there is problem in setting.
Methods above are ways to solve messy code when receiving data through serial to ethernet converter, and they can most of problem you have met.