In industrial control, there are two ways to read the status of the lower computer, one is the read port, for example, usingC LanguageInport () function. One is to use components, Microsoft's API-readfile (), and third-party controls. Reading the serial port can also read the status of the lower machine, while reading the port can also read the status of the lower machine. What is the difference?
1: inport can only read 8-bit register data, and readfile () can read many strings.
2: The storage method is different, and the speed is also different. Inport is real-time data, which is much faster than readfile but smaller in size.
In addition, you should pay attention to one problem during serial communication. If the receiving end processes faster or equal than the sending end, there is no limit, because the sending will be immediately charged. If the processing speed of the receiving end is slower than that of the sending end, a protocol is required. When the buffer zone is full, the sending end suspends the sending.