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

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.