CN118301176A - Nonstandard equipment data acquisition method and system based on serial port communication - Google Patents

Nonstandard equipment data acquisition method and system based on serial port communication Download PDF

Info

Publication number
CN118301176A
CN118301176A CN202410249025.9A CN202410249025A CN118301176A CN 118301176 A CN118301176 A CN 118301176A CN 202410249025 A CN202410249025 A CN 202410249025A CN 118301176 A CN118301176 A CN 118301176A
Authority
CN
China
Prior art keywords
serial port
port communication
nonstandard
nonstandard equipment
message
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202410249025.9A
Other languages
Chinese (zh)
Inventor
巩俊利
张文涛
孟飞
郭强
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Jie Kong Technology Co ltd
Original Assignee
Beijing Jie Kong Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Jie Kong Technology Co ltd filed Critical Beijing Jie Kong Technology Co ltd
Priority to CN202410249025.9A priority Critical patent/CN118301176A/en
Publication of CN118301176A publication Critical patent/CN118301176A/en
Pending legal-status Critical Current

Links

Landscapes

  • Communication Control (AREA)

Abstract

The invention relates to the technical field of industrial automation communication, and particularly discloses a nonstandard equipment data acquisition method and system based on serial port communication, wherein the method comprises the following steps: receiving a target message sent by non-standard equipment by using a serial port communication mode; and when the message header information of the target message accords with preset message header information, analyzing the target message to obtain target acquisition data of the nonstandard equipment. The invention realizes the data acquisition of nonstandard equipment with different communication protocols in a simple configuration mode, and can save a great amount of development resources and time.

Description

Nonstandard equipment data acquisition method and system based on serial port communication
Technical Field
The invention relates to the technical field of industrial automation communication, in particular to a nonstandard equipment data acquisition method and system based on serial port communication.
Background
In the industrial field, there are numerous small-sized special devices, such as various instruments, code scanning guns, and other non-standard devices, equipment manufacturers usually customize a special communication protocol of each non-standard device according to their own functions and characteristics, and the data of the non-standard devices needs to be collected to conform to the communication protocol of each manufacturer, which results in that corresponding serial communication protocols need to be developed for each different non-standard device, and a great amount of development resources are consumed.
Accordingly, there is a need to provide a solution to the above-mentioned problems.
Disclosure of Invention
In order to solve the technical problems, the invention provides a nonstandard equipment data acquisition method and system based on serial communication.
In a first aspect, the present invention provides a method for collecting nonstandard equipment data based on serial port communication, and the method has the following technical scheme:
Receiving a target message sent by non-standard equipment by using a serial port communication mode;
and when the message header information of the target message accords with preset message header information, analyzing the target message to obtain target acquisition data of the nonstandard equipment.
The nonstandard equipment data acquisition method based on serial port communication has the following beneficial effects:
The method of the invention realizes the data acquisition of nonstandard equipment with different communication protocols in a simple configuration mode, and can save a great deal of development resources and time.
Based on the scheme, the nonstandard equipment data acquisition method based on serial communication can be improved as follows.
In an optional manner, the step of receiving the target message sent by the nonstandard device by using a serial port communication manner includes:
and sending a response message to the nonstandard equipment by using a serial port communication mode so as to receive the target message generated by the nonstandard equipment according to the response message.
In an optional manner, the step of receiving the target message sent by the nonstandard device by using a serial port communication manner includes:
And receiving the target message actively sent by the nonstandard equipment by using a serial port communication mode.
In an alternative manner, the method further comprises:
Checking the response message;
The step of sending a response message to the nonstandard equipment by using a serial port communication mode comprises the following steps:
And when the verification is passed, sending the response message to the nonstandard equipment by using a serial port communication mode.
In an alternative manner, the method further comprises:
setting serial port communication parameters corresponding to the serial port communication mode.
In an alternative manner, the serial port communication parameters include: serial number, baud rate, check bit, communication interval time and communication timeout duration.
In a second aspect, the invention provides a nonstandard equipment data acquisition system based on serial port communication, and the technical scheme of the system is as follows:
Comprising the following steps: a receiving module and an operating module;
The receiving module is used for: receiving a target message sent by non-standard equipment by using a serial port communication mode;
the operation module is used for: and when the message header information of the target message accords with preset message header information, analyzing the target message to obtain target acquisition data of the nonstandard equipment.
The nonstandard equipment data acquisition system based on serial port communication has the following beneficial effects:
the system of the invention realizes the data acquisition of nonstandard equipment with different communication protocols in a simple configuration mode, and can save a great deal of development resources and time.
Based on the scheme, the nonstandard equipment data acquisition system based on serial communication can be improved as follows.
In an alternative manner, the receiving module is specifically configured to:
and sending a response message to the nonstandard equipment by using a serial port communication mode so as to receive the target message generated by the nonstandard equipment according to the response message.
The receiving module is specifically configured to:
And receiving the target message actively sent by the nonstandard equipment by using a serial port communication mode.
Further comprises: a verification module; the verification module is used for:
Checking the response message;
the step of sending a response message to the nonstandard equipment by using a serial port communication mode in the receiving module comprises the following steps:
And when the verification is passed, sending the response message to the nonstandard equipment by using a serial port communication mode.
The foregoing description is only an overview of the present invention, and is intended to be implemented in accordance with the teachings of the present invention in order that the same may be more clearly understood and to make the same and other objects, features and advantages of the present invention more readily apparent.
Drawings
The drawings are only for purposes of illustrating embodiments and are not to be construed as limiting the invention. Also, like reference numerals are used to designate like parts throughout the figures. In the drawings:
FIG. 1 is a flow chart of a first embodiment of a method for collecting nonstandard equipment data based on serial communication;
FIG. 2 is a flow chart of a second embodiment of a method for collecting nonstandard equipment data based on serial communication according to the invention;
FIG. 3 is a flow chart of a third embodiment of a method for collecting nonstandard equipment data based on serial communication according to the invention;
FIG. 4 is a flowchart of a fourth embodiment of a method for collecting nonstandard equipment data based on serial communication according to the present invention;
FIG. 5 is a schematic diagram of serial communication;
Fig. 6 is a schematic structural diagram of an embodiment of a nonstandard device data acquisition system based on serial communication according to the present invention.
Detailed Description
Exemplary embodiments of the present invention will be described in more detail below with reference to the accompanying drawings. While exemplary embodiments of the present invention are shown in the drawings, it should be understood that the present invention may be embodied in various forms and should not be limited to the embodiments set forth herein.
Fig. 1 is a schematic flow chart of a first embodiment of a non-standard device data collection method based on serial port communication, which is executed by a terminal device. As shown in fig. 1, the method comprises the following steps:
S110, receiving a target message sent by non-standard equipment by using a serial port communication mode.
Before S110 is executed, the terminal device and the non-standard device are connected through a serial port. Each non-standard device corresponds to a non-standard communication protocol, and the non-standard devices include, but are not limited to: various instruments, code guns, and other small devices are not limited herein. The target message is a response message sent by the nonstandard device to the terminal device, and the sending mode of the response message can be an active mode (active uploading) or a passive mode (uploading after receiving the instruction).
It should be noted that, the terminal device is provided with a communication driver A1 to implement receiving and processing of the message.
And S120, when the message header information of the target message accords with the preset message header information, analyzing the target message to obtain target acquisition data of non-standard equipment.
The preset message header information is preset message header information in the terminal equipment, the preset message header information can be stored through a setting database, and other data storage modes can be adopted to store the preset message header information, so that the limitation is not set. The target acquisition data is acquisition data of non-standard equipment required by the terminal equipment in the embodiment.
It should be noted that, the terminal device uses the stored "device data table" to parse the target message, and this process is not repeated here. As shown in fig. 4, a window A3 is provided in a communication driver A1 in the terminal device, and preset header information can be input in the window A3.
According to the technical scheme, nonstandard equipment data acquisition of different communication protocols is achieved in a simple configuration mode, and a large amount of development resources and time can be saved.
Fig. 2 is a schematic flow chart of a second embodiment of a non-standard device data collection method based on serial port communication, which is executed by a terminal device. As shown in fig. 2, the method comprises the following steps:
S210, sending a response message to the nonstandard equipment by using a serial port communication mode so as to receive a target message generated by the nonstandard equipment according to the response message.
Before S210 is executed, the terminal device and the non-standard device are connected through the serial port. The response message is a message sent by the terminal equipment to the nonstandard equipment, and the message is a custom message of a nonstandard protocol input in the terminal equipment. The non-standard device can generate a corresponding target message according to the corresponding message.
It should be noted that, as shown in fig. 4, the communication driver A1 in the terminal device provides a window A2, and may input a custom message of the nonstandard protocol through the window A2.
And S220, when the message header information of the target message accords with the preset message header information, analyzing the target message to obtain target acquisition data of non-standard equipment.
In an alternative manner, the method further comprises:
and checking the response message.
The step of sending a response message to the nonstandard device by using the serial port communication mode in S210 includes:
And when the verification is passed, sending a response message to the nonstandard equipment by using a serial port communication mode.
The verification mode is a conventional verification algorithm in serial port communication, and is not limited herein.
It should be noted that, as shown in fig. 4, the communication driver A1 in the terminal device provides the window A5, and a conventional verification algorithm in serial communication can be selected by the window A5 to perform verification calculation on the response message input by the terminal device A2.
According to the technical scheme, the terminal equipment is further used for sending the response message to the nonstandard equipment so as to receive the target message generated by the nonstandard equipment according to the response message, so that the nonstandard equipment data acquisition of different communication protocols is simply and rapidly realized, and a large amount of development resources and time can be saved.
Fig. 3 is a schematic flow chart of a third embodiment of a non-standard device data collection method based on serial port communication, which is executed by a terminal device. As shown in fig. 3, the method comprises the following steps:
S310, receiving a target message actively sent by non-standard equipment by using a serial port communication mode.
Wherein, before executing S310, the terminal device and the non-standard device are connected through the serial port. The terminal device can automatically wait for the message actively sent by the nonstandard device which has established the communication connection.
S320, when the message header information of the target message accords with the preset message header information, analyzing the target message to obtain target acquisition data of non-standard equipment.
According to the technical scheme, the target message sent by the nonstandard equipment is further actively received through the terminal equipment, so that the nonstandard equipment data of different communication protocols can be simply and rapidly acquired, and a large amount of development resources and time can be saved.
On the basis of any embodiment, the method further comprises the following steps:
Setting serial port communication parameters corresponding to the serial port communication mode.
The serial port communication parameters include: serial number, baud rate, check bit, communication interval time and communication timeout duration.
It should be noted that, as shown in fig. 4, the communication driver A1 in the terminal device provides a window A4, in which serial communication parameters in conventional serial communication can be input. In addition, the target message in any embodiment stores the required collected data, and the collected data can be obtained through a message analysis mode.
Fig. 5 is a schematic flow chart of a fourth embodiment of a non-standard device data collection method based on serial port communication, which is executed by a terminal device. As shown in fig. 5, the method comprises the following steps:
S410, receiving a target message sent by non-standard equipment by using a serial port communication mode.
Wherein, before executing S410, the terminal device and the non-standard device are connected through the serial port.
And S420, when the message header information of the target message accords with preset message header information, receiving the message information sent by the non-standard equipment in real time, and analyzing the message information sent by the non-standard equipment in real time to obtain real-time acquisition data of the non-standard equipment.
The target message in this embodiment corresponds to a check message, and does not include the collected data. If the target message meets the requirement, receiving and analyzing the message information containing the acquired data subsequently; if the target message does not meet the requirement, stopping receiving the message information containing the acquired data.
In an optional manner, the step of receiving the target message sent by the nonstandard device by using a serial port communication manner includes:
and sending a response message to the nonstandard equipment by using a serial port communication mode so as to receive a target message generated by the nonstandard equipment according to the response message.
In an optional manner, the step of receiving the target message sent by the nonstandard device by using a serial port communication manner includes:
And receiving the target message actively sent by the nonstandard equipment by using a serial port communication mode.
In an alternative manner, the method further comprises:
Checking the response message;
The step of sending a response message to the nonstandard equipment by using a serial port communication mode comprises the following steps:
And when the verification is passed, sending a response message to the nonstandard equipment by using a serial port communication mode.
In an alternative manner, the method further comprises:
Setting serial port communication parameters corresponding to the serial port communication mode.
In an alternative manner, the serial communication parameters include: serial number, baud rate, check bit, communication interval time and communication timeout duration.
According to the technical scheme, nonstandard equipment data acquisition of different communication protocols is achieved in a simple configuration mode, and a large amount of development resources and time can be saved.
Fig. 6 is a schematic structural diagram of an embodiment of a nonstandard device data acquisition system 500 based on serial communication according to the present invention. As shown in fig. 6, the system 500 includes: a receiving module 510 and a running module 520;
the receiving module 510 is configured to: receiving a target message sent by non-standard equipment by using a serial port communication mode; the operation module 520 is configured to: and when the message header information of the target message accords with the preset message header information, analyzing the target message to obtain target acquisition data of non-standard equipment.
In an alternative manner, the receiving module 510 is specifically configured to:
and sending a response message to the nonstandard equipment by using a serial port communication mode so as to receive a target message generated by the nonstandard equipment according to the response message.
In an alternative manner, the receiving module 510 is specifically configured to:
And receiving the target message actively sent by the nonstandard equipment by using a serial port communication mode.
In an alternative manner, the method further comprises: a verification module; the verification module is used for:
Checking the response message;
the step of sending a response message to the nonstandard device by using the serial port communication mode in the receiving module 510 includes:
And when the verification is passed, sending a response message to the nonstandard equipment by using a serial port communication mode.
In an alternative manner, the method further comprises: setting a module; the setting module is used for:
Setting serial port communication parameters corresponding to the serial port communication mode.
In an alternative manner, the serial communication parameters include: serial number, baud rate, check bit, communication interval time and communication timeout duration.
According to the technical scheme, nonstandard equipment data acquisition of different communication protocols is achieved in a simple configuration mode, and a large amount of development resources and time can be saved.
The steps for implementing the corresponding functions of each parameter and each module in the nonstandard device data collection system 500 based on serial port communication in this embodiment can refer to each parameter and each step in the embodiments of the nonstandard device data collection method based on serial port communication in the foregoing, and are not described herein in detail.
It should be noted that the terms "first," "second," and the like in the description and in the claims are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. The order of use of similar objects may be interchanged where appropriate such that embodiments of the application described herein may be implemented in other sequences than those illustrated or otherwise described.
Those skilled in the art will appreciate that the present invention may be embodied as a system, method or computer program product, and that the disclosure may therefore be embodied in the form of: either entirely hardware, entirely software (including firmware, resident software, micro-code, etc.), or entirely software, or a combination of hardware and software, referred to herein generally as a "circuit," module "or" system. Furthermore, in some embodiments, the invention may also be embodied in the form of a computer program product in one or more computer-readable media, which contain computer-readable program code.
Any combination of one or more computer readable media may be employed. The computer readable medium may be a computer readable signal medium or a computer readable storage medium. The computer readable storage medium can be, for example, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples (a non-exhaustive list) of the computer-readable storage medium would include the following: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of this document, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device.
While embodiments of the present invention have been shown and described above, it will be understood that the above embodiments are illustrative and not to be construed as limiting the invention, and that variations, modifications, alternatives and variations may be made to the above embodiments by one of ordinary skill in the art within the scope of the invention.

Claims (10)

1. The nonstandard equipment data acquisition method based on serial port communication is characterized by comprising the following steps of:
Receiving a target message sent by non-standard equipment by using a serial port communication mode;
and when the message header information of the target message accords with preset message header information, analyzing the target message to obtain target acquisition data of the nonstandard equipment.
2. The method for collecting data of nonstandard equipment based on serial port communication according to claim 1, wherein the step of receiving the target message sent by the nonstandard equipment by using the serial port communication mode comprises the following steps:
and sending a response message to the nonstandard equipment by using a serial port communication mode so as to receive the target message generated by the nonstandard equipment according to the response message.
3. The method for collecting data of nonstandard equipment based on serial port communication according to claim 1, wherein the step of receiving the target message sent by the nonstandard equipment by using the serial port communication mode comprises the following steps:
And receiving the target message actively sent by the nonstandard equipment by using a serial port communication mode.
4. The method for collecting nonstandard equipment data based on serial communication according to claim 2, further comprising:
Checking the response message;
The step of sending a response message to the nonstandard equipment by using a serial port communication mode comprises the following steps:
And when the verification is passed, sending the response message to the nonstandard equipment by using a serial port communication mode.
5. The method for collecting nonstandard equipment data based on serial port communication according to any one of claims 1 to 4, further comprising:
setting serial port communication parameters corresponding to the serial port communication mode.
6. The method for collecting nonstandard equipment data based on serial port communication according to claim 5, wherein the serial port communication parameters include: serial number, baud rate, check bit, communication interval time and communication timeout duration.
7. The nonstandard equipment data acquisition system based on serial port communication is characterized by comprising: a receiving module and an operating module;
The receiving module is used for: receiving a target message sent by non-standard equipment by using a serial port communication mode;
the operation module is used for: and when the message header information of the target message accords with preset message header information, analyzing the target message to obtain target acquisition data of the nonstandard equipment.
8. The nonstandard equipment data acquisition system based on serial communication according to claim 7, wherein the receiving module is specifically configured to:
and sending a response message to the nonstandard equipment by using a serial port communication mode so as to receive the target message generated by the nonstandard equipment according to the response message.
9. The nonstandard equipment data acquisition system based on serial communication according to claim 7, wherein the receiving module is specifically configured to:
And receiving the target message actively sent by the nonstandard equipment by using a serial port communication mode.
10. The serial communication-based nonstandard equipment data acquisition system as claimed in claim 8, further comprising: a verification module; the verification module is used for:
Checking the response message;
the step of sending a response message to the nonstandard equipment by using a serial port communication mode in the receiving module comprises the following steps:
And when the verification is passed, sending the response message to the nonstandard equipment by using a serial port communication mode.
CN202410249025.9A 2024-03-05 2024-03-05 Nonstandard equipment data acquisition method and system based on serial port communication Pending CN118301176A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202410249025.9A CN118301176A (en) 2024-03-05 2024-03-05 Nonstandard equipment data acquisition method and system based on serial port communication

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202410249025.9A CN118301176A (en) 2024-03-05 2024-03-05 Nonstandard equipment data acquisition method and system based on serial port communication

Publications (1)

Publication Number Publication Date
CN118301176A true CN118301176A (en) 2024-07-05

Family

ID=91673492

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202410249025.9A Pending CN118301176A (en) 2024-03-05 2024-03-05 Nonstandard equipment data acquisition method and system based on serial port communication

Country Status (1)

Country Link
CN (1) CN118301176A (en)

Similar Documents

Publication Publication Date Title
CN112995133B (en) Analysis method, device and system based on modbus protocol
CN105868040A (en) Log collection method and collection terminal
CN113765714B (en) Equipment network distribution method and device, storage medium and electronic equipment
CN113746821A (en) Intelligent device control method and device, storage medium and electronic device
CN113965904B (en) Device registration method, device and storage medium
CN108282374B (en) Method, system and readable storage medium for configuring NCSI network card
CN112422485B (en) Communication method and device of transmission control protocol
CN116991142A (en) Automobile diagnosis service method and system based on modularized UDS protocol
CN118301176A (en) Nonstandard equipment data acquisition method and system based on serial port communication
CN115167351B (en) Controller function updating method, system, vehicle and server
CN118300911A (en) Nonstandard equipment data acquisition method and system based on Ethernet communication
CN112992142B (en) Voice message reply method, device, equipment and medium
CN114900429A (en) Equipment communication parameter configuration method and system
CN114598602A (en) Data acquisition method and device, computer equipment and computer readable storage medium
CN114422625A (en) Data access method and gateway
CN108199918B (en) Method and system for testing washing machine
CN114442590A (en) Vehicle diagnosis method, apparatus, diagnosis communication device, server, and storage medium
CN114116544A (en) Method, device and equipment for acquiring slot information and storage medium
CN114124992B (en) Method, device, equipment and system for monitoring running state of whole vehicle domain controller
CN116827933B (en) Control method and device of cloud server, electronic equipment and storage medium
CN114238694B (en) Linux-based data processing method and device, electronic equipment and storage medium
CN113923270B (en) Message processing method, device, equipment and readable storage medium
CN116939066A (en) Internet of vehicles communication protocol adaptation method, system, equipment and medium
CN114328664A (en) Charging station operation and maintenance data acquisition method and system, electronic equipment and storage medium
CN111399907A (en) Command processing method, system, equipment and computer readable storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination