CN112650703A - RS485 serial port distribution method, device, equipment and computer readable storage medium - Google Patents

RS485 serial port distribution method, device, equipment and computer readable storage medium Download PDF

Info

Publication number
CN112650703A
CN112650703A CN202110019833.2A CN202110019833A CN112650703A CN 112650703 A CN112650703 A CN 112650703A CN 202110019833 A CN202110019833 A CN 202110019833A CN 112650703 A CN112650703 A CN 112650703A
Authority
CN
China
Prior art keywords
serial port
instruction
host
hosts
host communication
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
CN202110019833.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.)
Shanghai Shijie Industrial Technology Co ltd
Original Assignee
Shanghai Shijie Industrial 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 Shanghai Shijie Industrial Technology Co ltd filed Critical Shanghai Shijie Industrial Technology Co ltd
Priority to CN202110019833.2A priority Critical patent/CN112650703A/en
Publication of CN112650703A publication Critical patent/CN112650703A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F13/00Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
    • G06F13/38Information transfer, e.g. on bus
    • G06F13/42Bus transfer protocol, e.g. handshake; Synchronisation
    • G06F13/4282Bus transfer protocol, e.g. handshake; Synchronisation on a serial bus, e.g. I2C bus, SPI bus
    • G06F13/4286Bus transfer protocol, e.g. handshake; Synchronisation on a serial bus, e.g. I2C bus, SPI bus using a handshaking protocol, e.g. RS232C link
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F13/00Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
    • G06F13/38Information transfer, e.g. on bus
    • G06F13/40Bus structure
    • G06F13/4063Device-to-bus coupling
    • G06F13/4068Electrical coupling
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F5/00Methods or arrangements for data conversion without changing the order or content of the data handled
    • G06F5/06Methods or arrangements for data conversion without changing the order or content of the data handled for changing the speed of data flow, i.e. speed regularising or timing, e.g. delay lines, FIFO buffers; over- or underrun control therefor
    • G06F5/065Partitioned buffers, e.g. allowing multiple independent queues, bidirectional FIFO's

Abstract

The application relates to the field of industrial control, and provides an RS485 serial port distribution method, an RS485 serial port distribution device, RS485 serial port distribution equipment and a computer readable storage medium, so that cost is reduced, and system size and complexity are reduced. The method comprises the following steps: receiving instructions from at least two hosts from a serial port set, wherein the serial port set at least comprises two host communication serial ports, and each host communication interface in the at least two host communication interfaces correspondingly receives the instruction of one host; sending one command C of at least two host commands to the field device through the field device communication serial portiAnd receive instruction CiOperation result R ofi(ii) a Will instruct CiOperation result R ofiReturning to the sending instruction C through a host communication serial port in the serial port setiThe host computer of (1). The present application providesThe technical scheme has the advantages of low hardware cost and software cost, simple system control, strong reusability, small system volume, convenience in installation and use and the like, and can be quickly used in other subsequent places.

Description

RS485 serial port distribution method, device, equipment and computer readable storage medium
Technical Field
The invention relates to the field of industrial control, in particular to a method, a device, equipment and a computer readable storage medium for distributing an RS485 serial port.
Background
In a production place, many devices have an RS485 interface for networking function. RS485 is a standard defined to balance the electrical characteristics of drivers and receivers in digital multipoint systems, which is defined by the telecommunications industry association and the electronics industry consortium. In the RS485 communication network, a master-slave communication mode is generally adopted, that is, one master has a plurality of slaves. The host controls the data receiving and sending sequence on the bus, specifically, the host sends information to the slave machine No. 1, the slave machine No. 1 replies after receiving the information, then the host sends information to the slave machine No. 2, the slave machine No. 2 replies after receiving the information, and the like. If two hosts are needed in the system, for example, two PLCs communicate with field equipment, data confusion can be caused, and two hosts are needed in many places, for example, a central control room needs to acquire the field running state, and meanwhile, a safety monitoring platform also needs to acquire the field running state.
In order to solve the above-mentioned dilemma, the prior art provides a solution to customize the functions of a host, use a host to communicate with a field device, obtain the state of the field device, and store the state in a real-time memory. Because the device is provided with an RS485 serial port output, the device can also be used as a slave for a second host.
However, the above prior art schemes require customization of the PLC or DCS system, which is expensive in hardware cost and software cost, complex in function, unable to be used in other subsequent places, poor in reusability, and inconvenient to install and use.
Disclosure of Invention
The application provides an RS485 serial port distribution method, an RS485 serial port distribution device, RS485 serial port distribution equipment and a computer readable storage medium, so that cost is reduced, and system size and complexity are reduced.
On one hand, the application provides an RS485 serial port distribution method, which comprises the following steps:
receiving instructions from at least two hosts from a serial port set, wherein the serial port set at least comprises two host communication serial ports, and each host communication interface in the at least two host communication interfaces correspondingly receives the instruction of one host;
sending one instruction C in the instructions of the at least two hosts to the field equipment through the field equipment communication serial portiAnd receiving the instruction CiOperation result R ofi
The instruction CiOperation result R ofiReturning to send the instruction C through one host communication serial port in the slave serial port setiThe host computer of (1).
On the other hand, this application provides an RS485 serial ports distributor, includes:
the system comprises a receiving module, a processing module and a processing module, wherein the receiving module is used for receiving instructions from at least two hosts from a serial port set, the serial port set at least comprises two host communication serial ports, and each host communication interface in the at least two host communication interfaces correspondingly receives the instruction of one host;
a transceiver module for transmitting one command C of the commands of the at least two hosts to the field device via the field device communication serial portiAnd receiving the instruction CiOperation result R ofi
A return module for returning the instruction CiOperation result R ofiReturning to send the instruction C through one host communication serial port in the slave serial port setiThe host computer of (1).
In a third aspect, the application provides an RS485 serial port distribution device, where the RS485 serial port distribution device includes a field device communication serial port, at least two host communication serial ports, a single chip, a serial port level circuit, and a master-slave timing control module, and each host communication interface in the at least two host communication serial ports correspondingly receives an instruction of one host;
the single chip microcomputer is used for detecting the level of the serial port level circuit, receiving instructions from at least two hosts from the at least two host communication serial ports when detecting a first level, and sending one instruction C in the instructions of the at least two hosts to the field equipment through the field equipment communication serial portiAnd receiving the instruction CiOperation result R ofiWhen the second level of the serial port level circuit is detected, the instruction C is sentiOperation result R ofiReturning to send the instruction C through one host communication serial port in the slave serial port setiThe host of (2);
the serial port level circuit is used for providing the first level and the second level;
and the master-slave time sequence control module is used for controlling the at least two host communication serial ports and the field equipment communication serial ports to occupy bus resources according to a preset time sequence.
In a fourth aspect, the present application provides a system, where the system includes a field device, an RS485 serial port distribution device, and at least two hosts, where the RS485 serial port distribution device includes a field device communication serial port, at least two host communication serial ports, a single chip, a serial port level circuit, and a master-slave timing control module, and each host communication interface of the at least two host communication serial ports correspondingly receives an instruction of one host;
the RS485 serial port distribution equipment is used for detecting the level of the serial port level circuit, receiving instructions from at least two hosts from the at least two host communication serial ports when detecting a first level, and sending one instruction C in the instructions of the at least two hosts to the field equipment through the field equipment communication serial portiAnd receiving the instruction CiOperation result R ofiWhen the second level of the serial port level circuit is detected, the instruction C is sentiOperation result R ofiReturning to send the instruction C through one host communication serial port in the slave serial port setiThe host of (2);
the field device is used for receiving one command C from the commands of the at least two hosts from the field device communication serial portiAnd returning the instruction C to the RS485 serial port distribution equipmentiOperation result R ofi
Any one of the at least two hosts is used for sending the instruction C to the RS485 serial port distribution equipment through any one of the at least two host communication serial portsiAnd receiving the instruction CiOperation result R ofi
In a fifth aspect, the present application provides an apparatus, where the apparatus includes a memory, a processor, and a computer program stored in the memory and executable on the processor, and the processor implements the steps of the technical solution of the RS485 serial port distribution method when executing the computer program.
In a sixth aspect, the present application provides a computer-readable storage medium, where a computer program is stored, and when the computer program is executed by a processor, the steps of the technical solution of the RS485 serial port distribution method are implemented.
According to the technical scheme, the instructions from the at least two hosts can be received from the serial port set, and one instruction C in the instructions of the at least two hosts is sent to the field equipment through the communication serial port of the field equipmentiAnd receive instruction CiOperation result R ofiThe instruction CiOperation result R ofiReturning to the sending instruction C through a host communication serial port in the serial port setiTherefore, compared with the simple playback motion track in the prior art, the technical scheme provided by the application has the advantages of low hardware cost and software cost and simple system controlThe system has the advantages of being capable of being used in other subsequent places quickly, strong in reusability, small in system size, convenient to install and use and the like.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present application, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
Fig. 1 is a flowchart of an RS485 serial port distribution method provided in an embodiment of the present application;
fig. 2 is a schematic structural diagram of an RS485 serial port distribution device provided in the embodiment of the present application;
fig. 3 is a schematic structural diagram of an RS485 serial port distribution device provided in the embodiment of the present application;
FIG. 4 is a schematic structural diagram of a system provided by an embodiment of the present application;
fig. 5 is a schematic structural diagram of an apparatus provided in an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
In this specification, adjectives such as first and second may only be used to distinguish one element or action from another, without necessarily requiring or implying any actual such relationship or order. References to an element or component or step (etc.) should not be construed as limited to only one of the element, component, or step, but rather to one or more of the element, component, or step, etc., where the context permits.
In the present specification, the sizes of the respective portions shown in the drawings are not drawn in an actual proportional relationship for the convenience of description.
The application provides an RS485 serial port distribution method which can be applied to interaction with field devices and hosts in industrial production scenes. As shown in fig. 1, the RS485 serial port distribution method mainly includes steps S101 to S103, which are detailed as follows:
step S101: the method comprises the steps of receiving instructions from at least two hosts from a serial port set, wherein the serial port set at least comprises two host communication serial ports, and each host communication interface in the at least two host communication interfaces correspondingly receives the instruction of one host.
In this embodiment of the application, the serial port set of the RS485 serial port distribution device includes at least two host communication serial ports, and each host communication interface of the at least two host communication interfaces correspondingly receives an instruction of one host. For example, the serial port set of the RS485 serial port distribution device includes 3 host communication serial ports, and then each host communication serial port in the 3 host communication serial ports correspondingly receives an instruction of a host, that is, the 3 host communication serial ports can be connected to 3 hosts, and each host communication serial port is connected to a host.
Step S102: sending one command C of at least two host commands to the field device through the field device communication serial portiAnd receive instruction CiOperation result R ofi
In the embodiment of the application, the RS485 serial port distribution device further comprises a field device communication serial port. When receiving the instructions from the at least two hosts from the serial port set, one instruction C in the instructions of the at least two hosts can be sent to the field device through the field device communication serial portiAnd receiving the instruction C through the field device communication serial portiOperation result R ofi
In an embodiment of the present application, the instructions from the at least two hosts may be stored In the instruction cache unit, and specifically, the instructions from the at least two hosts may be stored In the instruction cache unit In a First-In First-Out (FIFO) manner. Therefore, the instructions which are sent to the RS485 serial port distribution equipment firstly can be ensured to be processed preferentially.
In another embodiment of the present application, the instructions from the at least two hosts may also be stored in the instruction cache unit according to instruction priorities, that is, according to the priorities of the instructions, the instructions with high priorities (for example, the instructions from the host with higher priority or the instructions with higher priority, etc.) are stored in the front of the instruction cache unit, and the instructions with low priorities (for example, the instructions from the host with lower priority) are stored in the rear of the instruction cache unit, so as to ensure that the instructions with high priorities can be processed preferentially after reaching the RS485 serial port distribution device.
According to one embodiment of the application, one command C in commands of at least two hosts is sent to the field device through the field device communication serial portiAnd receive instruction CiOperation result R ofiThe following can be explained by steps S1021 to S1023:
step S1021: sending one command C of at least two host commands to the field device through the field device communication serial portiAnd then waiting for the field device to reply.
In the embodiment of the application, the timing duration of the timer can be set, and one command C in at least two host commands is sent to the field deviceiAfter that, the timer starts to count time.
Step S1022: when receiving the operation result R replied by the field deviceiOr the timing time is exceeded, the next instruction C is read from the instruction cache unitj
In the embodiment of the present application, the next instruction C is read from the instruction cache unitjMay be the early stage issue instruction CiThe other instruction sent by the host computer can also be an instruction sent by another host computer. When receiving the operation result R replied by the field deviceiIn time, the next instruction C is read from the instruction cache unitj. As previously mentioned, at least two host commands are sent to the field device one at a timeInstruction CiAfter that, the timer starts to count time. If the field device is delayed and unable to return the command C due to the field deviceiOperation result R ofiIf the set timing duration is exceeded, the next instruction C is also read from the instruction cache unitj
Step S1023: sending the instruction C to the field equipment through the communication serial port of the field equipmentj
Step S103: will instruct CiOperation result R ofiReturning to the sending instruction C through a host communication serial port in the serial port setiThe host computer of (1).
As can be seen from the RS485 serial port distribution method illustrated in fig. 1, since the instructions from the at least two hosts can be received from the serial port set, one instruction C of the instructions of the at least two hosts is sent to the field device through the field device communication serial portiAnd receive instruction CiOperation result R ofiThe instruction CiOperation result R ofiReturning to the sending instruction C through a host communication serial port in the serial port setiCompared with the prior art, the host computer, therefore, the technical scheme that this application provided has that hardware cost and software are with low costs, and system control is simple, can be used for follow-up other places very fast, and the reusability is strong, and the system is small, advantages such as easy to assemble and use.
Referring to fig. 2, the RS485 serial port distribution apparatus provided in the embodiment of the present application may include a receiving module 201, a transceiver module 202, and a returning module 203, which are detailed as follows:
the receiving module 201 is configured to receive instructions from at least two hosts from a serial port set, where the serial port set at least includes two host communication serial ports, and each host communication interface of the at least two host communication interfaces correspondingly receives an instruction of one host;
a transceiver module 202 for sending one command C of the commands of the at least two hosts to the field device via the field device communication serial portiAnd receive instruction CiOperation result R ofi
Return module 203For instruction CiOperation result R ofiReturning to the sending instruction C through a host communication serial port in the serial port setiThe host computer of (1).
Optionally, the apparatus illustrated in fig. 2 may further include a saving module, configured to save the instructions from the at least two hosts in the instruction cache unit, specifically, the saving of the instructions from the at least two hosts in the instruction cache unit may be a saving of the instructions from the at least two hosts in the instruction cache unit in a first-in first-out manner.
Optionally, the transceiver module 202 illustrated in fig. 2 may include an instruction sending unit and an instruction reading unit, where:
an instruction sending unit for sending one instruction C of the instructions of at least two hosts to the field equipment through the field equipment communication serial portiThen, waiting for the field device to reply;
an instruction reading unit for reading the operation result R when receiving the reply of the field deviceiOr the timing time is exceeded, the next instruction C is read from the instruction cache unitj
The instruction sending unit is also used for sending an instruction C to the field equipment through the field equipment communication serial portj
Optionally, the apparatus illustrated in fig. 2 may further include a saving module, configured to save the instructions from the at least two hosts in the instruction cache unit.
Optionally, the saving module may include a first mode saving unit or a second mode saving unit, where:
the first mode storage unit is used for storing the instructions from the at least two hosts in the instruction cache unit in a first-in first-out mode;
and the second mode storage unit is used for storing the instructions from the at least two hosts in the instruction cache unit according to the instruction priority.
It can be known from the above description of the technical solution that the instructions from the at least two hosts can be received from the serial port set, and the at least two hosts are sent to the field device through the field device communication serial portOne of the instructions CiAnd receive instruction CiOperation result R ofiThe instruction CiOperation result R ofiReturning to the sending instruction C through a host communication serial port in the serial port setiCompared with the prior art, the host computer, therefore, the technical scheme that this application provided has that hardware cost and software are with low costs, and system control is simple, can be used for follow-up other places very fast, and the reusability is strong, and the system is small, advantages such as easy to assemble and use.
Referring to fig. 3, the RS485 serial port distribution device provided in this embodiment of the present application may include a field device communication serial port 302, at least two host communication serial ports 303, a single chip 301, a serial port level circuit 304, and a master-slave timing control module 305, where each host communication interface in the at least two host communication serial ports correspondingly receives a command of a host, and details are as follows:
a single chip microcomputer 301 for detecting the level of the serial port level circuit 304, receiving the commands from the at least two hosts from the at least two host communication serial ports 303 when a first level (e.g. high level) is detected, and sending one command C of the commands of the at least two hosts to the field device through the field device communication serial port 302iAnd receive instruction CiOperation result R ofiWhen the second level (e.g., low level) of the serial port level circuit 304 is detected, instruction C will be issuediOperation result R ofiReturning to the sending instruction C through a host communication serial port in the serial port setiThe host of (2);
a serial port level circuit 304 for providing a first level and a second level;
and the master-slave timing control module 305 is used for controlling at least two host communication serial ports 303 and the field device communication serial ports 302 to occupy bus resources according to a preset timing sequence.
Referring to fig. 4, the system provided in this embodiment of the present application includes a field device 402, an RS485 serial port distribution device 401, and at least two hosts 403, where the RS485 serial port distribution device includes a field device communication serial port, at least two host communication serial ports, a single chip, a serial port level circuit, and a master-slave timing control module, and each host communication interface in the at least two host communication serial ports correspondingly receives an instruction of one host;
the RS485 serial port distribution device 401 is used for detecting the level of a serial port level circuit, receiving instructions from at least two hosts 403 from at least two host communication serial ports when detecting a first level, and sending an instruction C in the instructions of the at least two hosts 403 to the field device through the field device communication serial portiAnd receive instruction CiOperation result R ofiWhen the second level of the serial port level circuit is detected, the instruction C is sentiOperation result R ofiReturning to the sending instruction C through a host communication serial port in the serial port setiThe host of (2);
a field device 402 for receiving one command C of the commands from the at least two hosts 403 from the field device communication serial portiAnd returns an instruction C to the RS485 serial port distribution equipment 401iOperation result R ofi
Any one of the at least two hosts 403 is configured to send an instruction C to the RS485 serial port distribution device 401 through any one of the at least two host communication serial portsiAnd receive instruction CiOperation result R ofi
Please refer to fig. 5, which is a schematic structural diagram of an apparatus according to an embodiment of the present application. As shown in fig. 5, the apparatus 5 of this embodiment mainly includes: a processor 50, a memory 51 and a computer program 52, such as a program of the RS485 serial distribution method, stored in the memory 51 and executable on the processor 50. The processor 50 executes the computer program 52 to implement the steps in the RS485 serial port distribution method embodiment, such as steps S101 to S103 shown in fig. 1. Alternatively, the processor 50, when executing the computer program 52, implements the functions of the modules/units in the above-described device embodiments, such as the functions of the receiving module 201, the transceiving module 202, and the returning module 203 shown in fig. 2.
Illustratively, the computer program 52 of the RS485 serial port distribution method mainly includes: receiving instructions from at least two hosts from a set of serial ports,the serial port set at least comprises two host communication serial ports, and each host communication interface in the at least two host communication interfaces correspondingly receives a host command; sending one command C of at least two host commands to the field device through the field device communication serial portiAnd receive instruction CiOperation result R ofi(ii) a Will instruct CiOperation result R ofiReturning to the sending instruction C through a host communication serial port in the serial port setiThe host computer of (1). The computer program 52 may be divided into one or more modules/units, which are stored in the memory 51 and executed by the processor 50 to complete the present application. One or more of the modules/units may be a series of computer program instruction segments capable of performing specific functions, which are used to describe the execution of the computer program 52 in the device 5. For example, the computer program 52 may be divided into functions of a receiving module 201, a transmitting and receiving module 202, and a returning module 203 (modules in the virtual device), and the specific functions of each module are as follows: the receiving module 201 is configured to receive instructions from at least two hosts from a serial port set, where the serial port set at least includes two host communication serial ports, and each host communication interface of the at least two host communication interfaces correspondingly receives an instruction of one host; a transceiver module 202 for sending one command C of the commands of the at least two hosts to the field device via the field device communication serial portiAnd receive instruction CiOperation result R ofi(ii) a A return module 203 for returning the instruction CiOperation result R ofiReturning to the sending instruction C through a host communication serial port in the serial port setiThe host computer of (1).
The device 5 may include, but is not limited to, a processor 50, a memory 51. Those skilled in the art will appreciate that fig. 5 is merely an example of a device 5 and does not constitute a limitation of device 5 and may include more or fewer components than shown, or some components may be combined, or different components, e.g., a computing device may also include input-output devices, network access devices, buses, etc.
The processor 50 may be a Central Processing Unit (CPU), other general purpose processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), an off-the-shelf Programmable gate array (FPGA) or other Programmable logic device, discrete gate or transistor logic, discrete hardware components, etc. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The memory 51 may be an internal storage unit of the device 5, such as a hard disk or a memory of the device 5. The memory 51 may also be an external storage device of the device 5, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), etc., provided on the device 5. Further, the memory 51 may also include both internal storage units of the device 5 and external storage devices. The memory 51 is used for storing computer programs and other programs and data required by the device. The memory 51 may also be used to temporarily store data that has been output or is to be output.
It will be apparent to those skilled in the art that, for convenience and brevity of description, only the above-mentioned division of the functional units and modules is illustrated, and in practical applications, the above-mentioned functions may be distributed as required to different functional units and modules, that is, the internal structure of the apparatus may be divided into different functional units or modules to implement all or part of the functions described above. Each functional unit and module in the embodiments may be integrated in one processing unit, or each unit may exist alone physically, or two or more units are integrated in one unit, and the integrated unit may be implemented in a form of hardware, or in a form of software functional unit. In addition, specific names of the functional units and modules are only for convenience of distinguishing from each other, and are not used for limiting the protection scope of the present application. The specific working processes of the units and modules in the above-mentioned apparatus may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
In the above embodiments, the descriptions of the respective embodiments have respective emphasis, and reference may be made to the related descriptions of other embodiments for parts that are not described or illustrated in a certain embodiment.
Those of ordinary skill in the art will appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus/device and method may be implemented in other ways. For example, the above-described apparatus/device embodiments are merely illustrative, and for example, a module or a unit may be divided into only one logic function, and may be implemented in other ways, for example, a plurality of units or components may be combined or integrated into another apparatus, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
Units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated modules/units, if implemented in the form of software functional units and sold or used as separate products, may be stored in a non-transitory computer readable storage medium. Based on such understanding, all or part of the processes in the method of the embodiments may also be implemented by instructing related hardware through a computer program, where the computer program of the RS485 serial port distribution method may be stored in a computer-readable storage medium, and when being executed by a processor, the computer program may implement the steps of the embodiments of the methods, that is, receiving instructions from at least two hosts from a serial port set, where the serial port set includes at least two host communication serial ports, and each host communication interface of the at least two host communication interfaces correspondingly receives an instruction of one host; sending one command C of at least two host commands to the field device through the field device communication serial portiAnd receive instruction CiOperation result R ofi(ii) a Will instruct CiOperation result R ofiReturning to the sending instruction C through a host communication serial port in the serial port setiThe host computer of (1). Wherein the computer program comprises computer program code, which may be in the form of source code, object code, an executable file or some intermediate form, etc. The non-transitory computer readable medium may include: any entity or device capable of carrying computer program code, recording medium, usb disk, removable hard disk, magnetic disk, optical disk, computer Memory, Read-only Memory (ROM), Random Access Memory (RAM), electrical carrier wave signals, telecommunications signals, software distribution media, and the like. It should be noted that the non-transitory computer readable medium may contain content that is subject to appropriate increase or decrease as required by legislation and patent practice in jurisdictions, for example, in some jurisdictions, non-transitory computer readable media does not include electrical carrier signals and telecommunications signals as subject to legislation and patent practice. The above embodiments are only used to illustrate the technical solutions of the present application, and not to limit the same; although the present application has been described in detail with reference to the foregoing embodimentsAs will be understood by those of ordinary skill in the art: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; such modifications and substitutions do not substantially depart from the spirit and scope of the embodiments of the present application and are intended to be included within the scope of the present application. The above-mentioned embodiments, objects, technical solutions and advantages of the present application are described in further detail, it should be understood that the above-mentioned embodiments are merely exemplary embodiments of the present application, and are not intended to limit the scope of the present application, and any modifications, equivalent substitutions, improvements and the like made within the spirit and principle of the present application should be included in the scope of the present invention.

Claims (10)

1. An RS485 serial port distribution method is characterized by comprising the following steps:
receiving instructions from at least two hosts from a serial port set, wherein the serial port set at least comprises two host communication serial ports, and each host communication interface in the at least two host communication interfaces correspondingly receives the instruction of one host;
sending one instruction C in the instructions of the at least two hosts to the field equipment through the field equipment communication serial portiAnd receiving the instruction CiOperation result R ofi
The instruction CiOperation result R ofiReturning to send the instruction C through one host communication serial port in the slave serial port setiThe host computer of (1).
2. The RS485 serial port distribution method according to claim 1, further comprising:
and storing the instructions from the at least two hosts in an instruction cache unit.
3. The RS485 serial port distribution method according to claim 2, wherein the storing the commands from the at least two hosts in a command cache unit includes:
and storing the instructions from the at least two hosts in the instruction cache unit according to a first-in first-out mode.
4. The RS485 serial port distribution method according to claim 2, wherein the storing the commands from the at least two hosts in a command cache unit includes:
and storing the instructions from the at least two hosts in the instruction cache unit according to the instruction priority.
5. The RS485 serial port distribution method according to claim 2, wherein one of the commands of the at least two hosts, command C, is sent to the field device through the field device communication serial portiAnd receiving the instruction CiOperation result R ofiThe method comprises the following steps:
sending one instruction C in the instructions of the at least two hosts to the field equipment through the field equipment communication serial portiThen, waiting for the field device to reply;
when receiving the operation result R replied by the field deviceiOr when the timing time is exceeded, reading a next instruction C from the instruction cache unitj
Sending the instruction C to the field equipment through the field equipment communication serial portj
6. The RS485 serial port distribution device is characterized by comprising:
the system comprises a receiving module, a processing module and a processing module, wherein the receiving module is used for receiving instructions from at least two hosts from a serial port set, the serial port set at least comprises two host communication serial ports, and each host communication interface in the at least two host communication interfaces correspondingly receives the instruction of one host;
a transceiver module for transmitting one command C of the commands of the at least two hosts to the field device via the field device communication serial portiAnd receiving the instruction CiOperation result R ofi
A return module for returning the instruction CiOperation result R ofiReturning to send the instruction C through one host communication serial port in the slave serial port setiThe host computer of (1).
7. The RS485 serial port distribution device is characterized by comprising a field device communication serial port, at least two host communication serial ports, a single chip microcomputer, a serial port level circuit and a master-slave time sequence control module, wherein each host communication interface of the at least two host communication serial ports correspondingly receives a host instruction;
the single chip microcomputer is used for detecting the level of the serial port level circuit, receiving instructions from at least two hosts from the at least two host communication serial ports when detecting a first level, and sending one instruction C in the instructions of the at least two hosts to the field equipment through the field equipment communication serial portiAnd receiving the instruction CiOperation result R ofiWhen the second level of the serial port level circuit is detected, the instruction C is sentiOperation result R ofiReturning to send the instruction C through one host communication serial port in the slave serial port setiThe host of (2);
the serial port level circuit is used for providing the first level and the second level;
and the master-slave time sequence control module is used for controlling the at least two host communication serial ports and the field equipment communication serial ports to occupy bus resources according to a preset time sequence.
8. A system is characterized by comprising field equipment, RS485 serial port distribution equipment and at least two hosts, wherein the RS485 serial port distribution equipment comprises a field equipment communication serial port, at least two host communication serial ports, a single chip microcomputer, a serial port level circuit and a master-slave time sequence control module, and each host communication interface in the at least two host communication serial ports correspondingly receives a host instruction;
the RS485 serial port distribution equipment is used for detecting the level of the serial port level circuit, receiving instructions from at least two hosts from the at least two host communication serial ports when detecting a first level, and sending one instruction C in the instructions of the at least two hosts to the field equipment through the field equipment communication serial portiAnd receiving the instruction CiOperation result R ofiWhen the second level of the serial port level circuit is detected, the instruction C is sentiOperation result R ofiReturning to send the instruction C through one host communication serial port in the slave serial port setiThe host of (2);
the field device is used for receiving one command C from the commands of the at least two hosts from the field device communication serial portiAnd returning the instruction C to the RS485 serial port distribution equipmentiOperation result R ofi
Any one of the at least two hosts is used for sending the instruction C to the RS485 serial port distribution equipment through any one of the at least two host communication serial portsiAnd receiving the instruction CiOperation result R ofi
9. An apparatus comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that the processor implements the steps of the method according to any one of claims 1 to 4 when executing the computer program.
10. A computer-readable storage medium, in which a computer program is stored which, when being executed by a processor, carries out the steps of the method according to any one of claims 1 to 4.
CN202110019833.2A 2021-01-07 2021-01-07 RS485 serial port distribution method, device, equipment and computer readable storage medium Pending CN112650703A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110019833.2A CN112650703A (en) 2021-01-07 2021-01-07 RS485 serial port distribution method, device, equipment and computer readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110019833.2A CN112650703A (en) 2021-01-07 2021-01-07 RS485 serial port distribution method, device, equipment and computer readable storage medium

Publications (1)

Publication Number Publication Date
CN112650703A true CN112650703A (en) 2021-04-13

Family

ID=75367567

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110019833.2A Pending CN112650703A (en) 2021-01-07 2021-01-07 RS485 serial port distribution method, device, equipment and computer readable storage medium

Country Status (1)

Country Link
CN (1) CN112650703A (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9767318B1 (en) * 2015-08-28 2017-09-19 Frank Dropps Secure controller systems and associated methods thereof
CN107590099A (en) * 2017-08-31 2018-01-16 深圳市共济科技股份有限公司 A kind of more main frames access method, expanding unit and the storage medium of slave
CN108733604A (en) * 2018-05-11 2018-11-02 深圳市脉联电子有限公司 A kind of 485 bus intelligent expansion method and devices based on modbus communications protocol
CN111427830A (en) * 2020-03-20 2020-07-17 广东电网有限责任公司 Data processing method and processor

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9767318B1 (en) * 2015-08-28 2017-09-19 Frank Dropps Secure controller systems and associated methods thereof
CN107590099A (en) * 2017-08-31 2018-01-16 深圳市共济科技股份有限公司 A kind of more main frames access method, expanding unit and the storage medium of slave
CN108733604A (en) * 2018-05-11 2018-11-02 深圳市脉联电子有限公司 A kind of 485 bus intelligent expansion method and devices based on modbus communications protocol
CN111427830A (en) * 2020-03-20 2020-07-17 广东电网有限责任公司 Data processing method and processor

Similar Documents

Publication Publication Date Title
US7603501B2 (en) Communication circuit of serial peripheral interface devices
CN106951388B (en) PCIe-based DMA data transmission method and system
CN108763140B (en) Bidirectional communication method, system and terminal equipment
JP2019508915A (en) Optimal latency packetizer finite state machine for messaging and I / O transfer interfaces
CN105468548B (en) Communication of serial peripheral interface
US10776306B2 (en) Serial port communication mode conversion method, system, and circuit
CN108563518A (en) Slave communication means, device, terminal device and storage medium
US20220335002A1 (en) Control Method and Apparatus
CN112463651A (en) QSPI controller, image processor and flash memory access method
CN104516838A (en) Management path determining method and device
CN113726498A (en) SPI-based dual-full-duplex communication method, host, slave and storage medium
CN107506323B (en) Hot plug processing method and device
US11288223B2 (en) Bridge chip with function of expanding external devices and associated expansion method
CN112988639A (en) Module address allocation method and device and data interaction system
CN112650703A (en) RS485 serial port distribution method, device, equipment and computer readable storage medium
CN113971148A (en) PCIE real-time network card data transmission method and device based on linux real-time operating system
CN109976778B (en) Software updating method and system of vehicle electronic product, upper computer and storage medium
CN112822087A (en) Data distinguishing method, data distinguishing device, router and network relay equipment
CN112765076B (en) MODBUS data processing method, device, equipment and computer readable storage medium
CN112631979A (en) Server and method for automatically distributing PCIE signals
CN105468098A (en) Mainboard of industrial personal computer
US9336174B1 (en) Dynamic interface model
CN108804362A (en) Serial ports bulk data transmission method, device and storage medium
CN210609213U (en) Configurable protocol conversion gateway
CN116226021B (en) Data receiving and transmitting method and device and graphics processor

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
RJ01 Rejection of invention patent application after publication

Application publication date: 20210413

RJ01 Rejection of invention patent application after publication