"Industrial serial port and network software communication Platform (Superio) tutorial" nine. Rewrite the communication interface function to implement special communication methods

Source: Internet
Author: User
Superio Related downloads: http://pan.baidu.com/s/1pJ7lZWf1.1 Unified IO Interface

The development of a set of equipment drivers at the same time with the serial port and network communication capabilities, communication interface is logically unified, on this basis, the serial port and the network also has its own IO communication characteristics, according to different means of communication, You can convert Iiochannel instances into Isessionsocket or isessioncom instances. Such as:

1.2 Communication requirements

A request command is sent two times, and the serial check digit is different each time the data is sent. First send address information, the configuration of the serial port is baud,m,8,1, and then send the request command information, then the serial port configuration is baud,s,8,1. This completes the command to request data one time. Such as:

1.3 Overriding the Communication interface

Device driver inherits SuperIO.Device.RunDevice1 abstract class, inside there is a virtual function send (Iiochannel io, byte[] sendbytes), io parameter is the communication operation instance, the Sendbytes parameter is the data information to be sent , you can override this interface function to complete a special send data request. Such as:

After receiving the data, you need to change the serial port settings to the default configuration to avoid affecting other device-driven communications, such as:

Author qq:504547114

QQ Group: 54256083

Official website: http://www.bmpj.net

"Industrial serial port and network software communication Platform (Superio) tutorial" nine. Rewrite the communication interface function to implement special communication methods

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.