Some problems of Mitsubishi PLC FX series programming port

xiaoxiao2021-03-06  100

---- For recent time, due to work, PC and PLC

Development of programming port communications. The development process has also passed a lot of detours, because the programming port communication protocol is not disclosed by Mitsubishi, so it is difficult to find a systematic textbook, collecting many of this information online. When I started debugging on VB, I sent a string "ABCD1234" according to its communication protocol, and then received in the PLC. At that time, it was only smooth to embedded Linux, but after defining the data structure, the port transmitted data PLC was not received. This is a comparative system analysis.

---- First I think of the difference in VB string and C string. Each English characters are running in VBs are double-bytes of Unicode characters, and it can be seen by lenb (char) = 2. Then turn to the UNICODE encoding problem, and the Unicode encoding is still not available. Later, I found out the information on VB serial port communication coding. I realized that the characters in VB will automatically convert to Unicode, but it turns into ASCII (referred to in English characters), VB is really a big liar, I have been on Big. Since it is not a code problem, it is certainly a port setting problem, or any other unknown issue. Then check the setting parameters. Open the COM1 in the VB to open the serial port, open the Super Terminal Monitor, and find that you can receive it correctly in any case in which you open the open parameters, you can receive it correctly! At least here can explain that the parameter settings specified in VB are also lie. Then check the settings of the port on the Linux program and compared to the communication protocol, and suddenly discovered that the parity is not correct, and its programming port is an even check. After the modification, run the program, the PLC indicator is on! ---- Through the above experience, the following experience is summarized:

1. The character encoding in VB is automatically converted internally, so do not test the data sent to the VB. It can be used to capture its binary values ​​in a way to use the COM1, 2 port, so that the data sent by VB can be clearly seen. (If you have not been successfully applied, in the commissioning phase)

2. To ensure the correctness of each port initialization parameter, the settings of any one and programming ports cannot be successfully communicated.

2004-6-18

转载请注明原文地址:https://www.9cbs.com/read-126827.html

New Post(0)