Tutorial on industrial serial port and network software communication platform (SuperIO) 9. Rewrite the communication interface function to implement special communication methods and network software superio
SuperIO related information download: http://pan.baidu.com/s/1pJ7lZWf1.1 unified IO Interface
Develop a set of device drivers with both serial port and network communication capabilities, and the communication interfaces are logically unified. On this basis, the serial port and network also have their own IO communication characteristics, according to different communication methods, you can convert an IIOChannel instance to an ISessionSocket or ISessionCom instance. For example:
1.2 communication requirements
A single request command is sent twice, and the serial port check bit varies each time the data is sent. First, send the address information. Then, configure the serial port as Baud, m, 8, and 1; then send the request Command Information. Then, configure the serial port as Baud, s, 8, and 1. This completes a Data Request command. For example:
1.3 rewrite Communication Interface
The device driver inherits SuperIO. device. runDevice1 abstract class, which contains a virtual function Send (IIOChannel io, byte [] sendbytes). The io parameter is a communication Operation instance, and the sendbytes parameter is the data information to be sent, you can rewrite this interface function to fulfill special data sending requirements. For example:
After receiving the data, you need to modify the serial port settings to the default configuration to avoid affecting the communication between drivers of other devices, such:
Author: QQ: 504547114
QQ group: 54256083
Http://www.bmpj.net