CN116017204A - Communication method and device based on HART protocol - Google Patents

Communication method and device based on HART protocol Download PDF

Info

Publication number
CN116017204A
CN116017204A CN202211633382.2A CN202211633382A CN116017204A CN 116017204 A CN116017204 A CN 116017204A CN 202211633382 A CN202211633382 A CN 202211633382A CN 116017204 A CN116017204 A CN 116017204A
Authority
CN
China
Prior art keywords
hart
channel
response data
data
data transmission
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
CN202211633382.2A
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.)
Hangzhou Hollysys Automation Co Ltd
Original Assignee
Hangzhou Hollysys Automation 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 Hangzhou Hollysys Automation Co Ltd filed Critical Hangzhou Hollysys Automation Co Ltd
Priority to CN202211633382.2A priority Critical patent/CN116017204A/en
Publication of CN116017204A publication Critical patent/CN116017204A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02PCLIMATE CHANGE MITIGATION TECHNOLOGIES IN THE PRODUCTION OR PROCESSING OF GOODS
    • Y02P90/00Enabling technologies with a potential contribution to greenhouse gas [GHG] emissions mitigation
    • Y02P90/02Total factory control, e.g. smart factories, flexible manufacturing systems [FMS] or integrated manufacturing systems [IMS]

Landscapes

  • Communication Control (AREA)

Abstract

The application discloses a communication method and device based on a HART protocol, which are applied to the field of analog acquisition, wherein the communication command of a main control station is acquired through analog acquisition equipment, a data transmission command is sent to a corresponding channel where a current HART device is located according to the communication command, whether response data of the HART device are received or not is judged, if the response data are received, the response data are stored, and otherwise, the data transmission command is sent to the channel where the next HART device is located. The main control station judges whether the current channel in the analog quantity acquisition equipment has response data which can be acquired, if so, the main control station acquires the response data, judges whether the next channel has the response data which can be acquired, and otherwise, the main control station enters the step of judging whether the next channel has the response data which can be acquired. And the system interaction efficiency is improved by the polling mode of the analog quantity acquisition equipment to the HART equipment and the polling mode of the main control station to the corresponding channel in the analog quantity acquisition equipment.

Description

Communication method and device based on HART protocol
Technical Field
The application relates to the field of analog quantity acquisition, in particular to a communication method and device based on a HART protocol.
Background
Along with the development of technology, in industrial automation control, various data acquisition is often involved, in the process of data acquisition, analog quantity acquisition equipment is increasingly and widely applied, and analog quantity signals can be acquired to a computer for users to refer to data by using the analog quantity acquisition equipment. At present, after the analog quantity acquisition equipment converts the acquired current signal into a voltage signal, the voltage signal is converted into digital quantity by a digital-to-analog converter in the analog quantity acquisition equipment, and the digital quantity is transmitted to the control unit, so that the data acquisition of the field equipment is realized.
The current analog quantity acquisition equipment acquires the acquired equipment according to own communication protocol in one acquisition period, after the equipment receives the acquisition result, the equipment transmits parameter information corresponding to open communication protocols (Highway Addressable Remote Transducer, HART) of a plurality of addressable remote sensor high-speed channels to a main control station, after the main control station receives the parameter information, the main control station utilizes one acquisition period again, screens effective information according to system configuration and discards useless information, and therefore data interaction is completed. At this time, the analog acquisition equipment is in a complex polling mode under multiple commands, so that the response period is longer, and the whole process of analog acquisition and communication interaction with the control unit is slower in speed and lower in efficiency.
How to solve the problem that the process efficiency of the analog acquisition equipment and the communication interaction with the control unit is low due to the complex interaction mode adopted by the current analog acquisition mode is a problem to be solved by the technicians in the field.
Disclosure of Invention
The purpose of the application is to provide a communication method and device based on the HART protocol, which adopts a simple polling interaction mode to improve the interaction efficiency of a system by adopting a polling mode of an analog quantity acquisition device to the HART device and a polling mode of a main control station to a corresponding channel in the analog quantity acquisition device, and meanwhile, the whole communication interaction process is smoother due to the addition of a data transmission instruction, so that the communication interaction speed is improved.
In order to solve the above technical problems, the present application provides a communication method based on HART protocol, including:
the analog quantity acquisition equipment acquires a communication command of a main control station, sends a data transmission command to a channel where a corresponding current HART device is located according to the communication command, judges whether response data of the HART device is received, stores the response data if the response data is received, and sends the data transmission command to the channel where the next HART device is located if the response data is not received;
the main control station judges whether the response data which can be acquired exists in the current channel in the analog quantity acquisition equipment, if so, the response data is acquired, and judges whether the response data which can be acquired exists in the next channel, and if not, the main control station enters the step of judging whether the response data which can be acquired exists in the next channel.
Preferably, the sending the data transmission instruction to the channel where the corresponding current HART device is located according to the communication command includes:
judging whether a channel where the HART equipment is positioned is enabled or not according to the communication command;
if yes, sending a data transmission instruction to a channel where the corresponding current HART equipment is located;
if not, judging whether the channel where the next HART device is located is enabled or not.
Preferably, the data transmission instruction includes: the system comprises a main control station, analog acquisition equipment, a first data transmission instruction and a second data transmission instruction, wherein the main control station is used for acquiring analog quantity data; and the second data transmission instruction characterizes that the main control station and the analog quantity acquisition equipment are ready for data transmission after data interaction is ready.
Preferably, the sending the data transmission instruction to the channel where the corresponding current HART device is located includes:
transmitting a first data transmission instruction to the HART device;
judging whether the response data of the HART equipment for the first data transmission instruction is received or not;
if the data is received, a second data transmission instruction is sent to the HART equipment;
if not, after waiting for the first preset time, entering the step of sending a second data transmission instruction to the HART equipment;
judging whether the response data of the HART equipment for the second data transmission instruction is received or not;
if yes, entering the step of storing the response data;
if not, after waiting for a second preset time, entering the step of sending a data transmission instruction to the channel where the next HART device is located.
Preferably, the response data is stored in a data buffer of the current channel, and after the response data is stored in the data buffer of the current channel, the method further comprises:
the reply data is marked as an identification that can be acquired by the master control station.
Preferably, in determining that the current channel in the analog quantity acquisition device does not have the response data that can be acquired, the method further includes:
and the analog quantity acquisition equipment sends a response identifier representing that the identification cannot be acquired to the main control station.
Preferably, the acquiring the response data includes:
judging whether the time of the response data transmission exceeds a threshold time or not;
if not, marking the response data as a normal response identifier, and entering the step of judging whether the response data which can be acquired exists in the next channel;
if yes, returning to the step of judging whether the channel where the HART device is currently located is enabled or not according to the communication command.
Preferably, after the analog acquisition device determines that the channel where the HART device is located is enabled again according to the communication command, the method further includes:
the main control station judges whether the current time of the response data transmission exceeds the threshold time again;
if the results of two consecutive times exceed the threshold time, the step of judging whether the next channel has the response data which can be acquired is carried out.
In order to solve the above technical problem, the present application further provides a communication device based on HART protocol, including: analog quantity acquisition equipment and a main control station; the analog quantity acquisition equipment acquires a communication command of a main control station, sends a data transmission command to a channel where a corresponding current HART device is located according to the communication command, judges whether response data of the HART device is received or not, stores the response data if the response data is received, and sends the data transmission command to the channel where the next HART device is located if the response data is not received;
the main control station judges whether the response data which can be acquired exists in the current channel in the analog quantity acquisition equipment, if so, the response data is acquired, and judges whether the response data which can be acquired exists in the next channel, and if not, the main control station enters the step of judging whether the response data which can be acquired exists in the next channel.
According to the communication method based on the HART protocol, the analog quantity acquisition equipment acquires a communication command of the main control station, sends a data transmission command to a channel where a corresponding current HART device is located according to the communication command, judges whether response data of the HART device are received, stores the response data if the response data are received, and sends the data transmission command to a channel where a next HART device is located if the response data are not received. The main control station judges whether the current channel in the analog quantity acquisition equipment has response data which can be acquired, if so, the main control station acquires the response data, judges whether the next channel has response data which can be acquired, and if not, the main control station enters the step of judging whether the next channel has response data which can be acquired. The polling mode of the analog quantity acquisition equipment to the HART equipment and the polling mode of the main control station to the corresponding channel in the analog quantity acquisition equipment are adopted, so that the interaction efficiency of the system is improved, and meanwhile, the whole communication interaction process is smoother due to the addition of the data transmission instruction, and the communication interaction speed is improved.
Drawings
For a clearer description of the embodiments of the present application, the drawings that are needed in the embodiments will be briefly described, it being apparent that the drawings in the following description are only some embodiments of the present application, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
Fig. 1 is a flow chart of an analog acquisition device of a communication method based on HART protocol according to an embodiment of the present application;
fig. 2 is a flow chart of a master control station of a communication method based on HART protocol according to an embodiment of the present application;
fig. 3 is a schematic diagram of a communication response mode between a master station and a slave station according to an embodiment of the present application;
fig. 4 is a flow chart of a polling state of HART data between a master station and a slave station according to an embodiment of the present application.
Detailed Description
The following description of the technical solutions in the embodiments of the present application will be made clearly and completely with reference to the drawings in the embodiments of the present application, and it is apparent that the described embodiments are only some embodiments of the present application, but not all embodiments. All other embodiments obtained by those skilled in the art based on the embodiments herein without making any inventive effort are intended to fall within the scope of the present application.
The core of the application is to provide a communication method based on the HART protocol, a simple polling interaction mode is adopted by the polling mode of the analog quantity acquisition equipment to the HART equipment and the polling mode of the main control station to the corresponding channel in the analog quantity acquisition equipment, so that the interaction efficiency of the system is improved, and meanwhile, the whole communication interaction process is smoother due to the addition of a data transmission instruction, so that the communication interaction speed is improved.
The operations of acquiring, transmitting, storing, judging and the like in the communication method based on the HART protocol provided by the application can be realized by a controller in an upper computer, for example, the controller can be a micro control unit (Microcontroller Unit; MCU), and of course, the operations can be realized by other controllers except the MCU.
In order to provide a better understanding of the present application, those skilled in the art will now make further details of the present application with reference to the drawings and detailed description.
Fig. 1 is a flow chart of an analog acquisition device of a communication method based on HART protocol according to an embodiment of the present application, where the method includes:
analog quantity acquisition equipment passes through S11: a communication command of the master control station is acquired. S12: and sending a data transmission instruction to the channel where the corresponding current HART device is located according to the communication command. S13: and judging whether response data of the HART device is received or not. If received, the process proceeds to S14: and storing the response data. If not, the process proceeds to S15: and sending a data transmission instruction to a channel where the next HART device is located.
Specifically, the analog quantity acquisition device in this embodiment can acquire corresponding data information by performing polling interaction with the HART device, and in this embodiment, the analog quantity acquisition device is an Input/Output (I/O) HART module, and the I/O HART module is connected to the HART device to acquire information through a channel, for example, if there are 16 HART devices, there are 16 corresponding communication channels, and the channel connects the I/O HART module and the HART device, so as to achieve the requirement of being able to independently transmit data. The main control station in this embodiment is a DP master station, and the I/Ohart module communicates with the DP master station as well, and the DP master station performs polling interaction on the I/Ohart module as well. Before communication, the DP master station issues a communication command to the I/Ohart module (i.e. DP slave station), where the communication command includes a channel parameter setting between the DP master station and each HART device, and information about whether each channel is enabled. The DP slave station acquires the communication command, and the DP slave station contains information whether each channel connected with the DP slave station is enabled or not, so that the DP slave station can communicate information with the enabled channel. And sending a data transmission instruction to a channel where the corresponding current HART device is located, wherein the HART device feeds back response data to the DP slave station according to the transmission instruction, the DP slave station can store the response data if receiving the response data, otherwise, if not receiving the response data fed back by the HART device, the DP slave station follows the communication interaction logic of polling in the embodiment, and sends the data transmission instruction to the channel where the next enabled HART device is located, and the process is repeated, so that the analog acquisition of the HART device is completed. It should be noted that the number of channels of the HART device is not limited in this embodiment, and 16 are only for those skilled in the art to better understand this embodiment.
Therefore, by arranging a separate communication channel between each HART device and the DP slave station and adding the polling communication interaction logic, the whole communication flow can be smoother, and the communication efficiency can be improved.
Fig. 2 is a flow chart of a master control station of a communication method based on HART protocol according to an embodiment of the present application, as shown in fig. 2, the master control station passes S16: judging whether available response data exist in the current channel in the analog quantity acquisition equipment. If so, the process proceeds to S17: response data is acquired. And S18: and judging whether the next channel has response data which can be acquired. If not, return to S18: and judging whether the next channel has available response data.
Fig. 3 is a schematic diagram of a communication response manner between a master station and a slave station provided in an embodiment of the present application, as shown in fig. 3, where the master station is the DP master station mentioned above in this embodiment, the DP slave station is an I/Ohart module in the previous embodiment, the DP master station and the DP slave station also follow the communication interaction logic of polling, and the DP master station sends a data receiving signal (hart_req) to the DP slave station, and when the DP slave station receives the hart_req, if there is no available response data in the channel, the corresponding diagram is: and receiving the request, and correspondingly, not preparing the request and replying a short response. At this time, the DP master station is prevented from waiting for too long, and a short reply (SC) mechanism is provided, which is mentioned above, and the DP master station replies to the SC when there is no data available for the DP master station, and at this time, the DP master station continues to poll (poll) the next channel until there is available reply data, and then obtains the reply data. The DP slave station stores the response data of the HART device after obtaining the response data, which will be described later, and the DP master station can obtain the response data from the data storage area of the DP slave station, and the DP master station also adopts the polled communication interaction logic, so that the DP master station determines whether the response data which can be obtained exists from the current channel, if so, the response data is obtained from the DP master station to complete communication interaction, and if not, the DP master station determines whether the response data which can be obtained exists in the next channel. When judging whether the next channel has available response data, if so, the same response data is obtained and the next channel is continuously judged by the same logic, and if not, the next channel is directly continuously judged by the same logic. And acquiring response data possibly existing in each channel through the cyclic mode. Thereby achieving the effect of polling.
According to the communication method based on the HART protocol, which is provided by the embodiment, the analog acquisition device acquires a communication command of the main control station, sends a data transmission command to a channel where a corresponding current HART device is located according to the communication command, judges whether response data of the HART device is received, stores the response data if the response data is received, and sends the data transmission command to a channel where a next HART device is located if the response data is not received. The main control station judges whether the current channel in the analog quantity acquisition equipment has response data which can be acquired, if so, the main control station acquires the response data, judges whether the next channel has response data which can be acquired, and if not, the main control station enters the step of judging whether the next channel has response data which can be acquired. The polling mode of the analog quantity acquisition equipment to the HART equipment and the polling mode of the main control station to the corresponding channel in the analog quantity acquisition equipment are adopted, so that the interaction efficiency of the system is improved, and meanwhile, the whole communication interaction process is smoother due to the addition of the data transmission instruction, and the communication interaction speed is improved.
Based on the above embodiments, as a preferred embodiment, sending, according to a communication command, a data transmission instruction to a channel where a corresponding current HART device is located includes:
judging whether a channel in which the current HART device is positioned is enabled or not according to the communication command;
if yes, sending a data transmission instruction to a channel where the corresponding current HART equipment is located;
if not, it is determined whether the channel in which the next HART device is located is enabled.
Specifically, in this embodiment, before communication, the DP master station issues a communication command to the DP slave station, where the communication command includes a channel parameter set with each HART device and information about whether each channel is enabled. The DP slave station acquires the communication command, and the DP slave station contains information whether each channel connected with the DP slave station is enabled or not, so that the DP slave station can communicate information with the enabled channel. It will be appreciated that it is necessary for the analog acquisition device, i.e. the DP slave, to acquire the enablement of each channel in advance, since data interaction is only possible when a channel is enabled. And for judging the enabling condition, the same polling mode is adopted, if the enabling is adopted, namely, the channel is started, namely, a data transmission instruction is sent to the channel where the corresponding current HART device is positioned, otherwise, whether the next channel is enabled or not is judged, and the data communication is ensured only for the enabled channel in a circulating and reciprocating mode.
Therefore, by acquiring the enabling conditions of all channels in advance, the data communication is ensured only for the enabled channels, the waste of system resources is avoided, and the running speed and fluency of the system are improved.
On the basis of the above embodiment, as a preferred embodiment, the data transmission instruction includes: the system comprises a first data transmission instruction and a second data transmission instruction, wherein the first data transmission instruction characterizes the preparation of data interaction between a main control station and analog acquisition equipment; the second data transmission instruction characterizes that the main control station and the analog acquisition equipment are ready for data transmission after data interaction is ready.
Specifically, the data transmission instruction in the present embodiment includes: the device comprises a first data transmission instruction and a second data transmission instruction. The first data transmission instruction is a 0# command known by a person skilled in the art, the second data transmission instruction is a 3# command known by a person skilled in the art, wherein the 0# command is an initial command, and after the 0# command is sent, the 3# command is continuously sent to realize further data transmission instructions.
Therefore, the data transmission instruction of the channel can be more specific during data communication by dividing the data transmission instruction into the 0# command and the 3# command, so that the effect of data transmission after preparation is completed is achieved.
Based on the foregoing embodiments, as a preferred embodiment, sending the data transmission instruction to the channel where the corresponding current HART device is located includes:
transmitting a first data transmission instruction to the HART device;
judging whether response data of the HART equipment for the first data transmission instruction is received or not;
if the data is received, a second data transmission instruction is sent to the HART equipment;
if not, after waiting for the first preset time, entering a step of sending a second data transmission instruction to the HART equipment;
judging whether response data of the HART equipment for the second data transmission instruction is received or not;
if yes, entering a step of storing response data;
if not, after waiting for a second preset time, entering a step of sending a data transmission instruction to the channel where the next HART device is located.
Specifically, the data transmission instruction according to the previous embodiment in this embodiment includes: the device comprises a first data transmission instruction and a second data transmission instruction. The analog quantity acquisition device firstly transmits a 0# command to the corresponding HART device through a channel, when response data about the 0# command is normally received, the 3# command is continuously transmitted, if the response data is not received, the first preset time can be set according to user requirements, the 3# command is still transmitted to the HART device after the first preset time is exceeded, at the moment, the HART device can always receive the 3# command, or the HART device immediately receives the 3# command after feeding back the response data to the DP slave station, or the DP slave station waits for a preset time set by a user, for example, after 1.5 seconds, the 3# command is received. After the DP slave station sends the 3# command, if the HART device responds to the 3# command, the response data is placed in the HART data buffer area of the corresponding channel, and the prepared identifier of the characterization data is marked, so that the DP master station can quickly identify whether the available response data exists when the current channel is polled. Similarly, similar to the logic for sending the 0# command, if no HART device is receiving a response to the 3# command, the 0# command is resent to the channel on which the next HART device is located.
It can be seen that by setting the data transfer instruction to the 0# command and the 3# command, the data transfer instruction to the channel can be more specific at the time of data communication, and the effect of data transfer after preparation is completed can be achieved.
On the basis of the above embodiment, as a preferred embodiment, the method further includes, after storing the response data in the data buffer of the current channel:
the reply data is marked as an identification that can be acquired by the master control station.
Specifically, in this embodiment, the DP master station acquires data from a corresponding channel in the DP slave station in a polling manner, and after the DP slave station acquires the response data, the DP slave station places the response data in a data buffer in the DP slave station, and marks the response data with a flag indicating that the data is ready, so that the DP master station can quickly identify whether the available response data exists when polling the current channel.
Therefore, by placing the response data in the data buffer area and marking the response data as the identifier which can be acquired by the main control station, the judgment of whether the acquired response data exists or not can be rapidly made when the DP main station polls the corresponding channel, and the accuracy and the stability of communication are improved.
On the basis of the above embodiment, as a preferred embodiment, in determining that there is no response data available in the current channel in the analog quantity acquisition device, the method further includes:
the analog quantity acquisition equipment sends a response identifier representing that the response identifier cannot be acquired to the main control station.
Specifically, in this embodiment, when the DP master station determines that the current channel does not have the available response data, in order to make the whole system operate more smoothly, the analog acquisition device sends a short response to the DP master station without making a long stay in a certain flow, so that the DP master station can quickly know the current situation and operate the next channel in time.
Therefore, by increasing the response of the short response, the stay time in the current link is avoided, the running period of the system is shortened, and the running speed of the system is increased.
On the basis of the above embodiment, as a preferred embodiment, the obtaining response data includes:
judging whether the time of the response data transmission exceeds a threshold time or not;
if not, marking the response data as a normal response identifier, and entering a step of judging whether the response data which can be acquired exists in the next channel;
if the channel is exceeded, the method returns to the step of judging whether the channel where the current HART device is located is enabled or not according to the communication command.
Specifically, in this embodiment, it is required to determine whether the time of transmission of the reply data is overtime, for example, the user defines the reply time between the master DP slave stations to be within 1s, that is, the total time from the start of obtaining the reply data to the DP slave station until the reply data is obtained cannot exceed 1s, if not, it is determined as a normal reply, and if not, it is determined whether the next channel has available reply data, otherwise if overtime, it is required to determine again whether overtime, as described in detail below.
Therefore, by prescribing the data transmission time, too much time waste in the process of waiting for data transmission can be avoided, the running period of the system is shortened, and meanwhile, the running speed of the system is increased.
Based on the above embodiments, as a preferred embodiment, after the analog acquisition device determines, according to the communication command, that the channel where the HART device is currently located is enabled again, the method further includes:
the main control station judges whether the current time of response data transmission exceeds the threshold time again;
if the results of two consecutive times exceed the threshold time, the method proceeds to a step of judging whether the next channel has available response data.
Specifically, in this embodiment, since the specified response threshold time range is set, after the range is exceeded, the DP master station re-determines whether the current data transmission time still exceeds the above threshold time, and if the two results exceed the threshold time, the current response data is directly discarded, because timeliness cannot be ensured due to timeout, even if there is a possibility that the data is tampered, and continuously determines whether there is response data that can be acquired in the next channel.
Fig. 4 is a flow chart of a polling state of HART data between a master station and a slave station according to an embodiment of the present application, as shown in fig. 4, where the polling flow includes: s19: IDLE: and initializing a state and initializing a timer. S20: ch_sel: a channel selection state, when the master DP slave station enters HART data polling, starting after 1 minute; during normal circulation, 1.5s polls once, and a hart enabled channel polls 0# and 3# commands in sequence; and in the tooling mode, configuring a HART polling channel by the upper computer. When the delay arrives, the state is jumped to the ch_valid state. S21: ch_valid: and (4) judging whether the HART channel is enabled or not according to the channel valid state, and jumping to S22 if the HART channel is enabled or the tool mode is enabled currently: sw_ctrl state, otherwise jump to S20: ch_sel selects the next channel. S22: sw_ctrl: and the channel analog switch is in a control state and is used for controlling the channel switch to switch. S23: send_wait: the wait state is sent, delayed by 10ms, and the send_data state is skipped. S24: send_data: a transmit data state, transmitting a 0# or 3# command, respectively, according to the HART command, clearing hart_rx_fifo (HART buffer data), and jumping to S25: send_complete state. S25: send_complete: a transmission completion state, in which the completion of the transmission of the HART request data is waited, and the process goes to S26: recv_data state. S26: recv_data: receiving the data state, starting to receive the HART data after the transmission is completed, and judging the overtime (1 s) of the reception; when normal reception is completed, the process goes to S27: res_ok_packet state; if the reception is timeout, jump to S20: the CH_SEL state, polling the next channel or command code; if the current polling channel has received the 3# command code twice in succession times out, the process goes to S28: res_err_packet state. S27: res_ok_packet: and setting a normal response packet flag, and jumping to a complete_res state. S28: res_err_packet: and (3) setting a response time-out packet group state, setting a response time-out packet group mark, and jumping to S29: complete_res state. S29: complete_res: the reception data completion state, when the response data group packet is completed, the process goes to S20: ch_sel state.
Specifically, the time parameters in this embodiment, for example, 1 minute, 1.5s, etc. may be set according to the actual needs of the user, and the embodiment is not limited in particular. The tool mode is a mode to be operated, the master DP slave station is in a HART communication mode, and the master DP station and the slave DP station in the whole system are in the mode. At S24: the HART_RX_FIFO is cleared in the SEND_DATA, and the information received by the HART DATA buffer is cleared to prepare for the follow-up formal response DATA, so that the confusion of test DATA and actual DATA is avoided. It is understood that steps S20 to S23 in this embodiment are all performed to pad the following actual received data. In addition, the flag information of the response data in this embodiment may be other identifiable flags, which are not particularly limited in this embodiment.
The application also provides a communication device based on the HART protocol, comprising: analog quantity acquisition equipment and a main control station; the analog quantity acquisition equipment internally comprises an independent three-system circuit, acquires a communication command of the main control station, sends a data transmission command to a corresponding channel where the current HART equipment is located according to the communication command, judges whether response data of the HART equipment are received, stores the response data if the response data are received, and sends the data transmission command to a channel where the next HART equipment is located if the response data are not received;
the main control station judges whether the current channel in the analog quantity acquisition equipment has response data which can be acquired, if so, the main control station acquires the response data, judges whether the next channel has response data which can be acquired, and if not, the main control station enters the step of judging whether the next channel has response data which can be acquired.
Specifically, in this embodiment, the analog quantity acquisition device is added from the original circuit of the separate channel to the three independent circuits in each channel, each MCU receives the HART configuration information issued by the DP master station, periodically sends HART commands of 0# and 3# to access the HART enabled channel, writes the HART commands into the local field programmable gate array (Field Programmable Gate Array, FPGA), reads HART data from the local FPGA, and if HART data exists, queries and stores HART data of each channel to the local, and waits for non-periodic HART data reading of the DP master station. The local system FPGA sends the local system HART data to the three system public logic units, and stores the HART response data into the local system FPGA to inform the MCU to read; the common logic unit of the three systems receives the three systems of FPGA through a universal asynchronous receiver/Transmitter (Universal Asynchronous Receiver/Transmitter, UART), inquires whether HART data exists, selects one system of data to send to the HART chip when the HART data exists, receives the data of the HART chip, and sends the received data to the 3 systems of FPGA through a serial peripheral interface (Serial Peripheral Interface, SPI); and starting HART communication through the response and data interaction between the DP master station and the DP slave station, entering into a HART self-polling mode, and carrying out the interaction of HART communication data to realize the control of HART communication. Through the mode, the original signal acquisition mode of the whole system is realized by directly acquiring the signals from a single wire of a field device, and single-channel single-thread voting is realized, so that the availability of the channel after failure can not be ensured. The availability after the channel failure is increased by adding an independent three-system circuit, the original '1' is changed into the existing '3', and the running stability of the system is ensured.
The HART protocol-based communication method and device provided by the present application are described in detail above. In the description, each embodiment is described in a progressive manner, and each embodiment is mainly described by the differences from other embodiments, so that the same similar parts among the embodiments are mutually referred. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant points refer to the description of the method section. It should be noted that it would be obvious to those skilled in the art that various improvements and modifications can be made to the present application without departing from the principles of the present application, and such improvements and modifications fall within the scope of the claims of the present application.
It should also be noted that in this specification, relational terms such as first and second, and the like are used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Moreover, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.

Claims (9)

1. A method of HART protocol based communication, comprising:
the analog quantity acquisition equipment acquires a communication command of a main control station, sends a data transmission command to a channel where a corresponding current HART device is located according to the communication command, judges whether response data of the HART device is received, stores the response data if the response data is received, and sends the data transmission command to the channel where the next HART device is located if the response data is not received;
the main control station judges whether the response data which can be acquired exists in the current channel in the analog quantity acquisition equipment, if so, the response data is acquired, and judges whether the response data which can be acquired exists in the next channel, and if not, the main control station enters the step of judging whether the response data which can be acquired exists in the next channel.
2. The HART protocol-based communication method according to claim 1, wherein the sending the data transmission command to the channel where the corresponding current HART device is located according to the communication command comprises:
judging whether a channel where the HART equipment is positioned is enabled or not according to the communication command;
if yes, sending a data transmission instruction to a channel where the corresponding current HART equipment is located;
if not, judging whether the channel where the next HART device is located is enabled or not.
3. The HART protocol-based communication method of claim 2, wherein the data transmission instructions comprise: the system comprises a main control station, analog acquisition equipment, a first data transmission instruction and a second data transmission instruction, wherein the main control station is used for acquiring analog quantity data; and the second data transmission instruction characterizes that the main control station and the analog quantity acquisition equipment are ready for data transmission after data interaction is ready.
4. A method of HART protocol based communication according to claim 3, wherein said sending data transfer instructions to the channel on which the corresponding current HART device is located comprises:
transmitting a first data transmission instruction to the HART device;
judging whether the response data of the HART equipment for the first data transmission instruction is received or not;
if the data is received, a second data transmission instruction is sent to the HART equipment;
if not, after waiting for the first preset time, entering the step of sending a second data transmission instruction to the HART equipment;
judging whether the response data of the HART equipment for the second data transmission instruction is received or not;
if yes, entering the step of storing the response data;
if not, after waiting for a second preset time, entering the step of sending a data transmission instruction to the channel where the next HART device is located.
5. The HART protocol-based communication method according to claim 4, wherein storing the response data in the data buffer of the current channel, after storing the response data in the data buffer of the current channel, further comprises:
the reply data is marked as an identification that can be acquired by the master control station.
6. The HART protocol-based communication method according to claim 5, wherein when it is determined that the response data available for the current channel in the analog quantity acquisition device does not exist, further comprising:
and the analog quantity acquisition equipment sends a response identifier representing that the identification cannot be acquired to the main control station.
7. The HART protocol-based communication method according to claim 1, wherein the acquiring the response data comprises:
judging whether the time of the response data transmission exceeds a threshold time or not;
if not, marking the response data as a normal response identifier, and entering the step of judging whether the response data which can be acquired exists in the next channel;
if yes, returning to the step of judging whether the channel where the HART device is currently located is enabled or not according to the communication command.
8. The HART protocol based communication method according to claim 7, wherein after the analog acquisition device determines again that the channel in which the HART device is currently located is enabled according to the communication command, further comprising:
the main control station judges whether the current time of the response data transmission exceeds the threshold time again;
if the results of two consecutive times exceed the threshold time, the step of judging whether the next channel has the response data which can be acquired is carried out.
9. A HART protocol-based communication device, comprising: analog quantity acquisition equipment and a main control station;
the analog quantity acquisition equipment is used for acquiring a communication command of a main control station, sending a data transmission command to a channel where a corresponding current HART device is located according to the communication command, judging whether response data of the HART device are received or not, storing the response data if the response data are received, and sending the data transmission command to the channel where the next HART device is located if the response data are not received;
and the main control station is used for judging whether the response data which can be acquired exists in the current channel in the analog quantity acquisition equipment, if so, acquiring the response data, judging whether the response data which can be acquired exists in the next channel, and if not, entering the step of judging whether the response data which can be acquired exists in the next channel.
CN202211633382.2A 2022-12-19 2022-12-19 Communication method and device based on HART protocol Pending CN116017204A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211633382.2A CN116017204A (en) 2022-12-19 2022-12-19 Communication method and device based on HART protocol

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211633382.2A CN116017204A (en) 2022-12-19 2022-12-19 Communication method and device based on HART protocol

Publications (1)

Publication Number Publication Date
CN116017204A true CN116017204A (en) 2023-04-25

Family

ID=86018674

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211633382.2A Pending CN116017204A (en) 2022-12-19 2022-12-19 Communication method and device based on HART protocol

Country Status (1)

Country Link
CN (1) CN116017204A (en)

Similar Documents

Publication Publication Date Title
US11010327B2 (en) I3C point to point
EP3008610B1 (en) Camera control interface extension bus
US7990890B2 (en) Communication management apparatus and method for an audio data communication management system
CN109996325B (en) Clock synchronization system and method of wireless sensor network
CN112565036B (en) Data transmission method, device, storage medium and communication system
JP2004260831A (en) Hybrid data transmission apparatus suitable for high speed wireless communication and its method
US7421527B2 (en) Transmission apparatus and transmission method
CN116017204A (en) Communication method and device based on HART protocol
US6952276B2 (en) Printer detecting data precisely in response to change in data transmission speed
CN111008169B (en) Low-cost high-speed communication bus and transmission control method thereof
JPH09266488A (en) Data communication system
CN116541329A (en) Data transmission method, device, equipment and medium
CN111130678B (en) Data transmission method, device, equipment and computer readable storage medium
CN116436526A (en) Method, device, system, storage medium and electronic equipment for controlling signal transmission
CN108123863B (en) Communication system and communication method of household appliance and household appliance
US11520729B2 (en) I2C bus architecture using shared clock and dedicated data lines
CN111984576B (en) Data communication system and method
CN1574848B (en) Ensuring maximum reaction times in complex or distributed safe and/or nonsafe systems
CN109586832B (en) Wireless synchronization method, wireless slave, wireless master and wireless synchronization system
KR101426712B1 (en) Method and device for data transmission with full duplex based on serial peripheral interface
CN116133108B (en) Data synchronization method for low-power consumption Bluetooth communication and electronic equipment
CN116418094B (en) Charger and single bus communication method thereof
CN113127401B (en) Earphone box and earphone communication method and system
US6570666B1 (en) Printer detecting data precisely in response to change in data transmission speed
JP2006033490A (en) Data communication device, and communication system

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