CN115687215A - Serial port multiplexing method, device, equipment and storage medium - Google Patents

Serial port multiplexing method, device, equipment and storage medium Download PDF

Info

Publication number
CN115687215A
CN115687215A CN202211373470.3A CN202211373470A CN115687215A CN 115687215 A CN115687215 A CN 115687215A CN 202211373470 A CN202211373470 A CN 202211373470A CN 115687215 A CN115687215 A CN 115687215A
Authority
CN
China
Prior art keywords
expansion card
serial port
access
type
level signal
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
CN202211373470.3A
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.)
Shenzhen Inovance Technology Co Ltd
Original Assignee
Shenzhen Inovance 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 Shenzhen Inovance Technology Co Ltd filed Critical Shenzhen Inovance Technology Co Ltd
Priority to CN202211373470.3A priority Critical patent/CN115687215A/en
Publication of CN115687215A publication Critical patent/CN115687215A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Information Transfer Systems (AREA)

Abstract

The invention relates to the technical field of communication, and discloses a serial port multiplexing method, a device, equipment and a storage medium, wherein the method comprises the following steps: acquiring a model detection signal received by a detection pin in the serial port, and determining the type of an expansion card accessed to the expansion card according to the model detection signal; and performing function adaptation with the access expansion card according to the type of the expansion card, and performing data communication with the external equipment through the access expansion card after the function adaptation is completed. The invention determines the type of the expansion card accessed into the expansion card through the model detection signal received by the detection pin arranged in the serial port, performs function adaptation with the accessed expansion card according to the type of the expansion card, and performs data communication with the external equipment through the accessed expansion card after the function adaptation is completed, thereby solving the technical problem that one serial port can only be adapted with the functions of one user equipment in the prior art, realizing the multiplexing of the serial port and improving the utilization rate of serial port resources.

Description

Serial port multiplexing method, device, equipment and storage medium
Technical Field
The present invention relates to the field of communications technologies, and in particular, to a serial port multiplexing method, apparatus, device, and storage medium.
Background
The application of serial communication is more and more common, and user equipment passes through serial ports access host computer to carry out data transmission, at present, a serial ports generally can only insert a kind of user equipment to with a kind of user equipment's functional adaptation, and along with the increase of user demand function, current serial resources can't satisfy user's actual demand, therefore how to improve the utilization ratio of serial resources becomes the technical problem that awaits a moment and solve.
The above is only for the purpose of assisting understanding of the technical solution of the present invention, and does not represent an admission that the above is the prior art.
Disclosure of Invention
The invention mainly aims to provide a serial port multiplexing method, a serial port multiplexing device, serial port multiplexing equipment and a storage medium, and aims to solve the technical problem of low serial port resource utilization rate in the prior art.
In order to achieve the above object, the present invention provides a serial port multiplexing method, comprising the following steps:
acquiring a model detection signal received by a detection pin in a serial port, and determining the type of an expansion card accessed to the expansion card according to the model detection signal;
and performing function adaptation with the access expansion card according to the type of the expansion card, and performing data communication with external equipment through the access expansion card after the function adaptation is completed.
Optionally, the obtaining a model detection signal received by a detection pin in the serial port, and determining a type of an expansion card accessed to the expansion card according to the model detection signal includes:
acquiring a model detection signal received by a detection pin in a serial port, and determining the number of an expansion card accessed to the expansion card according to the model detection signal;
and determining the type of the expansion card accessed to the expansion card according to the number of the expansion card.
Optionally, after obtaining the model detection signal received by the detection pin in the serial port, the method further includes:
when the model detection signal is an idle signal, judging that the serial port does not access the expansion card; and
and when the serial port does not access the expansion card, entering a standby mode.
Optionally, the performing function adaptation with the access expansion card according to the type of the expansion card, and performing data communication with an external device through the access expansion card after the function adaptation is completed includes:
when the type of the expansion card is an analog quantity expansion card, the expansion card is in function adaptation with the analog quantity expansion card;
and after the function adaptation with the analog quantity expansion card is completed, acquiring analog quantity data sent by access equipment through the analog quantity expansion card.
Optionally, the performing function adaptation with the access expansion card according to the type of the expansion card, and performing data communication with an external device through the access expansion card after the function adaptation is completed, further includes:
when the expansion card type is an analog expansion card, the function adaptation is carried out on the expansion card and the analog expansion card;
after completing the function adaptation with the analog quantity expansion card, acquiring analog quantity parameters input by a user;
and outputting the target analog quantity to the access equipment through the analog quantity expansion card according to the analog quantity parameters.
Optionally, the performing function adaptation with the access expansion card according to the type of the expansion card, and performing data communication with an external device through the access expansion card after the function adaptation is completed includes:
when the expansion card type is a level signal expansion card, the function adaptation is carried out on the expansion card with the level signal expansion card;
after the function adaptation with the level signal expansion card is completed, converting the level signal output by the serial port into a target level signal through the level signal expansion card;
and transmitting the target level signal to access equipment through the level signal expansion card.
Optionally, the transmitting the target level signal to an access device through the level signal expansion card includes:
acquiring transmission parameters input by a user;
and transmitting the target level signal to access equipment through the level signal expansion card according to the transmission parameter.
In addition, in order to achieve the above object, the present invention further provides a serial port multiplexing apparatus, including:
the detection module is used for acquiring a model detection signal received by a detection pin in the serial port and determining the type of the expansion card accessed to the expansion card according to the model detection signal;
and the function adapting module is used for carrying out function adaptation with the access expansion card according to the type of the expansion card and carrying out data communication with external equipment through the access expansion card after the function adaptation is finished.
In addition, in order to achieve the above object, the present invention further provides a serial port multiplexing device, including: the serial port multiplexing program is configured to implement the steps of the serial port multiplexing method.
In addition, in order to achieve the above object, the present invention further provides a storage medium, where the storage medium stores a serial multiplexing program, and the serial multiplexing program implements the steps of the serial multiplexing method when executed by a processor.
The method comprises the steps of obtaining a model detection signal received by a detection pin in a serial port, and determining the type of an expansion card accessed to the expansion card according to the model detection signal; and performing function adaptation with the access expansion card according to the type of the expansion card, and performing data communication with external equipment through the access expansion card after the function adaptation is completed. The invention determines the type of the expansion card accessed into the expansion card through the model detection signal received by the detection pin arranged in the serial port, performs function adaptation with the accessed expansion card according to the type of the expansion card, and performs data communication with the external equipment through the accessed expansion card after the function adaptation is completed, thereby solving the technical problem that one serial port can only be adapted with the functions of one user equipment in the prior art, realizing the multiplexing of the serial port and improving the utilization rate of serial port resources.
Drawings
Fig. 1 is a schematic structural diagram of a serial port multiplexing device in a hardware operating environment according to an embodiment of the present invention;
fig. 2 is a schematic flowchart of a serial port multiplexing method according to a first embodiment of the present invention;
fig. 3 is a schematic flowchart of a serial port multiplexing method according to a second embodiment of the present invention;
FIG. 4 is a schematic diagram of establishing a communication connection between a host and an expansion card in an embodiment of the serial port multiplexing method of the present invention;
FIG. 5 is a schematic flow chart of a serial port multiplexing method according to a third embodiment of the present invention;
fig. 6 is a block diagram of the serial port multiplexing apparatus according to the first embodiment of the present invention.
The implementation, functional features and advantages of the objects of the present invention will be further explained with reference to the accompanying drawings.
Detailed Description
It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
Referring to fig. 1, fig. 1 is a schematic structural diagram of a serial port multiplexing device in a hardware operating environment according to an embodiment of the present invention.
As shown in fig. 1, the serial port multiplexing device may include: a processor 1001, such as a Central Processing Unit (CPU), a communication bus 1002, a user interface 1003, a network interface 1004, and a memory 1005. The communication bus 1002 is used to implement connection communication among these components. The user interface 1003 may include a Display screen (Display), an input unit such as a Keyboard (Keyboard), and the optional user interface 1003 may also include a standard wired interface, a wireless interface. The network interface 1004 may optionally include a standard wired interface, a Wireless interface (e.g., a Wireless-Fidelity (WI-FI) interface). The Memory 1005 may be a Random Access Memory (RAM) or a Non-Volatile Memory (NVM), such as a disk Memory. The memory 1005 may alternatively be a storage device separate from the processor 1001.
Those skilled in the art will appreciate that the configuration shown in fig. 1 does not constitute a limitation of a serial port multiplexing device, and may include more or fewer components than those shown, or some components may be combined, or a different arrangement of components.
As shown in fig. 1, the memory 1005, which is a storage medium, may include an operating system, a network communication module, a user interface module, and a serial multiplexing program.
In the serial port multiplexing device shown in fig. 1, the network interface 1004 is mainly used for data communication with a network server; the user interface 1003 is mainly used for data interaction with a user; the processor 1001 and the memory 1005 in the serial multiplexing device of the present invention may be arranged in the serial multiplexing device, and the serial multiplexing device calls the serial multiplexing program stored in the memory 1005 through the processor 1001 and executes the serial multiplexing method provided by the embodiment of the present invention.
An embodiment of the present invention provides a serial port multiplexing method, and referring to fig. 2, fig. 2 is a schematic flow chart of a first embodiment of the serial port multiplexing method according to the present invention.
In this embodiment, the serial port multiplexing method includes the following steps:
step S10: and acquiring a model detection signal received by a detection pin in the serial port, and determining the type of the expansion card accessed to the expansion card according to the model detection signal.
It should be noted that the execution subject of this embodiment may be a computing service device with data processing, network communication, and program running functions, or an electronic device, a computer, a serial port multiplexing device, a host, and the like that can implement the above functions. The present embodiment and the following embodiments are described below by taking the host as an example.
It can be understood that a serial interface, also called a serial communication interface or a serial communication interface (usually referred to as a COM interface), is an extended interface adopting a serial communication mode; the detection pins can be preset input and output pins for receiving model detection signals, the detection pins are pins in a serial port on the host, the number of the detection pins is at least one, and the detection pins can be set according to the number of the types of the expansion cards; the model detection signal can be a level signal used for determining the type of the access expansion card, and the model detection signal corresponds to the type of the expansion card; the access expansion card can be an expansion card which establishes communication connection with the host through a serial port; the type of the expansion card includes an analog expansion card, an RS485 expansion card, an RS232 expansion card, a digital expansion card, or other expansion cards using serial port communication, and the embodiment is not limited herein.
It should be understood that the expansion card establishes communication connection with the host through the serial port, when the expansion card accesses the host through the serial port, a detection pin in the serial port on the host establishes connection with a corresponding pin in the access expansion card, the pin in the access expansion card sends a model detection signal, the host receives the model detection signal through the detection pin, and determines the type of the expansion card accessed to the expansion card according to the received model detection signal and the corresponding relationship between the model detection signal and the type of the expansion card.
Step S20: and performing function adaptation with the access expansion card according to the type of the expansion card, and performing data communication with external equipment through the access expansion card after the function adaptation is completed.
It is understood that the function adaptation may be related software adaptation with the access expansion card to adapt to the functions implemented by the user equipment accessed through the access expansion card; after the function adaptation with the access expansion card is completed, the host can carry out data communication with the external equipment through the access expansion card, and realize corresponding functions through the external equipment.
It should be noted that, the general application of serial communication causes that the serial resource of a processor cannot meet the actual requirements of users, and therefore, the utilization rate of the serial resource needs to be improved by multiplexing the same serial port, at present, the serial multiplexing can be realized by adding an FPGA device, but the use of the FPGA device can cause the cost increase of software and hardware, and the expandable function is limited, and still cannot meet the requirements of users, so this embodiment provides a serial multiplexing method, a detection pin is arranged in a serial port interface of a host, the detection pin receives a model detection signal, when the expansion card establishes communication connection with the host through a serial port, the pin corresponding to the expansion card sends the model detection signal representing the model to the detection pin, the host determines the model of the expansion card to be accessed through the model detection signal received by the detection pin, performs software function adaptation according to the model of the expansion card, and after the adaptation is completed, performs data communication with an access device through the access expansion card, the multiplexing can be realized without adding the FPGA device, and the serial resource utilization rate can be improved by only setting the detection pin and the corresponding signal sending pin.
In specific implementation, for example, a preset correspondence between a type detection signal and an expansion card type is shown in table 1, assuming that an access device establishes communication connection with a host through an expansion card A1, when the A1 accesses the host through a serial port, a pin in the A1 sends the type detection signal a to a detection pin, after receiving the signal a, the detection pin determines that the type of the expansion card accessing the expansion card is A1, sends the expansion card type A1 to a background for software function adaptation, and after the adaptation is completed, performs data communication with the access device through the A1.
Model detection signal Expansion card type
A A1
B B1
C C1
Further, in order to determine the type of the expansion card accessing the expansion card, so as to perform function adaptation with the access expansion card according to the type of the expansion card, the step S10 includes: acquiring a model detection signal received by a detection pin in a serial port, and determining the number of an expansion card accessed to the expansion card according to the model detection signal; and determining the expansion card type of the access expansion card according to the expansion card number.
It is to be understood that the expansion card number may be a number set for different types of expansion cards, and the expansion card number may identify the expansion card type.
In specific implementation, for example, numbering expansion cards on hardware to obtain expansion card numbers corresponding to each type of expansion card, that is, expansion card IDs, assuming that model detection signals are output through 4 pins, numbers of high and low levels can be realized through an up-down pull resistor or a dial switch of the hardware, the high and low levels are input to 4 IO pins (that is, 4 detection pins) of a host through a connector, the host determines the types of the expansion cards according to level signals received by the 4 detection pins and numbers preset for the expansion cards, and the 4 detection pins can represent 16 numbers; the number of the detection pins may be determined according to the number of the expansion card types, and assuming that the number of the expansion card types is 3, 2 detection pins may be provided, which is not limited herein.
Further, in order to save the operation resources, after obtaining the model detection signal received by the detection pin in the serial port, the method further includes: when the model detection signal is an idle signal, judging that the expansion card is not accessed to the serial port; and entering a standby mode when the serial port does not access the expansion card.
It can be understood that the idle signal may be a preset signal indicating that the serial port does not access the expansion card; the standby mode may be a mode in which no function adaptation is performed for a serial port to which the expansion card is not accessed.
In this embodiment, a single serial port adopts the same structure to carry out multiplex communication to extension host computer serial port function need not carry out logic control, and the user can select the accessory by oneself according to specific demand, but also can design the same a plurality of serial ports on the host computer and carry out multiplex communication, makes the user can arrange multiple expansion card according to specific demand and use, and implementation is simple, has reduced software and hardware cost.
In a specific implementation, for example, if 4 detection pins are provided, the number of the expansion card may be represented by a 4-bit binary number, where 1 represents that a level signal received by the detection pin is a high level signal, and 0 represents that a level signal received by the detection pin is a low level signal, the level signal received by the detection pin when the expansion card is not accessed may be set to 1111 in a weak pull-up manner, and when the expansion card is accessed, the detection pin may receive a level signal corresponding to the type of the expansion card; when the level signal received by the detection pin is 1111, it indicates that the expansion card is not accessed, and at this time, the relevant operation of function adaptation is not performed, and when the detection pin receives other level signals, the corresponding expansion card type is determined according to the level signal, and function adaptation is performed according to the expansion card type.
The method comprises the steps of obtaining a model detection signal received by a detection pin in a serial port, and determining the type of an expansion card accessed to the expansion card according to the model detection signal; and performing function adaptation with the access expansion card according to the type of the expansion card, and performing data communication with external equipment through the access expansion card after the function adaptation is completed. According to the embodiment, the type of the expansion card accessed to the expansion card is determined through the type detection signal received by the detection pin arranged in the serial port, the function adaptation is carried out according to the type of the expansion card and the accessed expansion card, and after the function adaptation is completed, the data communication is carried out through the accessed expansion card and the external equipment, so that the technical problem that one serial port can only adapt to the function of one user equipment in the prior art is solved, the multiplexing of the serial port is realized, and the utilization rate of serial port resources is improved.
Referring to fig. 3, fig. 3 is a schematic flowchart of a serial port multiplexing method according to a second embodiment of the present invention.
Based on the first embodiment described above, in the present embodiment, the step S20 includes:
step S201: and when the type of the expansion card is an analog expansion card, performing function adaptation with the analog expansion card.
It can be understood that the analog expansion card can be an expansion card for collecting analog quantity, the inside of the analog expansion card is mainly provided with an MCU and an AD/DA conversion circuit, and the host machine controls the analog expansion card to carry out AD/DA conversion through serial port communication; the function adaptation with the analog quantity expansion card can be the communication protocol and software adaptation with the analog quantity expansion card.
Step S202: and after the function adaptation with the analog quantity expansion card is completed, acquiring analog quantity data sent by access equipment through the analog quantity expansion card.
In a specific implementation, referring to fig. 4, fig. 4 is a schematic diagram of establishing a communication connection between a host and an expansion card, assuming that the host and the expansion card are connected through a connector, the types of the expansion card include an RS485 expansion card 1, an RS232 expansion card 2, and an analog expansion card 3, a detection pin is an ID [0..3], and TX and RX are pins for performing data transmission; ID [0..3] indicates that the model detection signal is received through 4 IO pins, and the corresponding relationship between the number of the expansion card and the type of the expansion card determined according to the model detection signal is as follows: 0001-RS485 expansion card 1, 0010-RS232 expansion cards 2 and 0011-analog expansion card 3, wherein the host determines that the number of the expansion card is 0011 according to a model detection signal received by a detection pin, then determines that the type of the expansion card accessed to the expansion card is analog expansion card 3, at the moment, software configures the host as a master station, the analog expansion card 3 as a slave station, serial port communication is carried out through a mod bus protocol, analog quantity accessed to equipment is collected through the analog expansion card 3, the collected analog quantity is received through the analog expansion card, and an AD/DA conversion circuit is further arranged in the analog expansion card 3.
Further, in order to output the analog quantity to the access device according to the actual requirement of the user through the analog quantity expansion card, the step S20 further includes: when the type of the expansion card is an analog quantity expansion card, the expansion card is in function adaptation with the analog quantity expansion card; after completing function adaptation with the analog quantity expansion card, acquiring analog quantity parameters input by a user; and outputting the target analog quantity to the access equipment through the analog quantity expansion card according to the analog quantity parameters.
It is understood that the analog parameter may be a parameter for controlling the output of the analog to the access device by the analog expansion card; for example, the analog parameters are: and outputting the 2V voltage, and controlling the analog quantity expansion card to output the 2V voltage to the access equipment.
In specific implementation, the host determines that the number of the expansion card is 0011 according to a model detection signal received by the detection pin, and then determines that the type of the expansion card connected to the expansion card is the analog expansion card 3, and after the function adaptation with the analog expansion card 3 is completed, it is assumed that the analog parameters input by the user are obtained as follows: and outputting 2V voltage, controlling the analog expansion card 3 to output 2V voltage to the access device, where the analog parameter may also be another parameter, and the embodiment is not limited herein.
In this embodiment, when the type of the expansion card is an analog expansion card, the function adaptation is performed with the analog expansion card; and after the function adaptation with the analog quantity expansion card is completed, acquiring analog quantity data sent by access equipment through the analog quantity expansion card. When the access expansion card is the analog expansion card, the function adaptation is carried out on the access expansion card and the analog expansion card, after the function adaptation is completed, the analog data sent by the access device is obtained through the analog expansion card, the analog data can be received through the serial port, and the utilization rate of serial port resources is improved.
Referring to fig. 5, fig. 5 is a schematic flowchart of a serial port multiplexing method according to a third embodiment of the present invention.
Based on the foregoing embodiments, in this embodiment, the step S20 further includes:
step S21: and when the expansion card type is a level signal expansion card, performing function adaptation with the level signal expansion card.
It can be understood that the level signal expansion card comprises an RS485 expansion card and an RS232 expansion card, wherein an RS485 interface chip is mainly arranged in the RS485 expansion card, and the level signal of the serial port is converted into an RS485 level through a 485 circuit to carry out RS485 communication; the RS232 expansion card is mainly internally provided with an RS232 interface chip, and level signals of a serial port are converted into RS232 levels through a 232 circuit to carry out RS232 communication.
Step S22: after the level signal expansion card completes functional adaptation, converting the level signal output by the serial port into a target level signal through the level signal expansion card;
step S23: and transmitting the target level signal to access equipment through the level signal expansion card.
In specific implementation, with reference to fig. 4, the level signal expansion card includes an RS485 expansion card 1 and an RS232 expansion card 2, the corresponding expansion card numbers are 0001 and 0010, respectively, when the host determines that the expansion card number is 0001 according to the model detection signal received by the detection port, the host determines that the expansion card type is the RS485 expansion card 1, performs functional adaptation with the RS485 expansion card 1, sets the host as a master station, sets the access device as a slave station, performs serial port communication through a mod bus protocol, converts a serial port level signal into an RS485 level signal through a 485 circuit inside the RS485 expansion card 1, and transmits the RS485 level signal to the access device; when the host determines that the serial number of the expansion card is 0010 according to the model detection signal received by the detection port, the host determines that the type of the expansion card is RS232 expansion card 2, the expansion card is in functional adaptation with the RS232 expansion card 2, the host is set as a master station, the access device is set as a slave station, serial port communication is carried out through a mod bus protocol, a level signal of a serial port is converted into an RS232 level signal through a 232 circuit in the RS232 expansion card 2, and an R232 level signal is transmitted to the access device; the host and the expansion card are connected by a foolproof connector, and the protocol of the serial communication can also select other protocols according to specific use scenes, which is not limited in the embodiment.
Further, in order to perform data transmission according to the user requirement, the step S23 includes: acquiring transmission parameters input by a user; and transmitting the target level signal to access equipment through the level signal expansion card according to the transmission parameter.
It is understood that the transmission parameters include a communication rate, a data length, a parity bit, and a stop bit.
In this embodiment, the host may also periodically detect a model detection signal received by the detection pin, and determine whether the access expansion card is replaced according to the model detection signal, and when the access expansion card is replaced, automatically perform function adaptation with the replaced expansion card; can communication, digital DIDO acquisition and the like can be carried out through the serial port; the serial ports can be flexibly combined to meet the combination requirements of the RS485 expansion cards, the RS232 expansion cards and/or the analog expansion cards, and can be determined according to specific use scenes, and the embodiment is not limited herein.
In this embodiment, when the type of the expansion card is a level signal expansion card, the function adaptation is performed with the level signal expansion card; after the level signal expansion card completes functional adaptation, converting the level signal output by the serial port into a target level signal through the level signal expansion card; and transmitting the target level signal to access equipment through the level signal expansion card. When the access expansion card is a level signal expansion card, the function adaptation is carried out on the level signal expansion card, and the level signal expansion card converts the signals of the serial port into the target level signals and transmits the target level signals to the access equipment, so that the multiplexing of the serial port is realized, and the utilization rate of serial port resources is improved.
In addition, an embodiment of the present invention further provides a storage medium, where a serial multiplexing program is stored in the storage medium, and the serial multiplexing program implements the steps of the serial multiplexing method when executed by a processor.
Referring to fig. 6, fig. 6 is a block diagram of a serial port multiplexing apparatus according to a first embodiment of the present invention.
As shown in fig. 6, the serial port multiplexing apparatus provided in the embodiment of the present invention includes:
the detection module 10 is configured to obtain a model detection signal received by a detection pin in the serial port, and determine the type of an expansion card that is accessed to the expansion card according to the model detection signal;
and the function adapting module 20 is used for performing function adaptation with the access expansion card according to the type of the expansion card and performing data communication with external equipment through the access expansion card after the function adaptation is completed.
The method comprises the steps of obtaining a model detection signal received by a detection pin in a serial port, and determining the type of an expansion card accessed to the expansion card according to the model detection signal; and performing function adaptation with the access expansion card according to the type of the expansion card, and performing data communication with external equipment through the access expansion card after the function adaptation is completed. According to the embodiment, the type of the expansion card accessed to the expansion card is determined through the type detection signal received by the detection pin arranged in the serial port, the function adaptation is carried out according to the type of the expansion card and the accessed expansion card, and after the function adaptation is completed, the data communication is carried out through the accessed expansion card and the external equipment, so that the technical problem that one serial port can only adapt to the function of one user equipment in the prior art is solved, the multiplexing of the serial port is realized, and the utilization rate of serial port resources is improved.
Based on the first embodiment of the serial port multiplexing device, a second embodiment of the serial port multiplexing device is provided.
In this embodiment, the detection module 10 is further configured to obtain a model detection signal received by a detection pin in a serial port, and determine an expansion card number of an access expansion card according to the model detection signal; and determining the type of the expansion card accessed to the expansion card according to the number of the expansion card.
The detection module 10 is further configured to determine that the serial port does not access the expansion card when the model detection signal is an idle signal; and entering a standby mode when the serial port does not access the expansion card.
The function adapting module 20 is further configured to perform function adaptation with the analog expansion card when the type of the expansion card is an analog expansion card; and after the function adaptation with the analog quantity expansion card is completed, acquiring analog quantity data sent by access equipment through the analog quantity expansion card.
The function adapting module 20 is further configured to perform function adaptation with the analog expansion card when the type of the expansion card is an analog expansion card; after completing function adaptation with the analog quantity expansion card, acquiring analog quantity parameters input by a user; and outputting the target analog quantity to the access equipment through the analog quantity expansion card according to the analog quantity parameters.
The function adapting module 20 is further configured to perform function adaptation with the level signal expansion card when the type of the expansion card is a level signal expansion card; after the function adaptation with the level signal expansion card is completed, converting the level signal output by the serial port into a target level signal through the level signal expansion card; and transmitting the target level signal to access equipment through the level signal expansion card.
The function adapting module 20 is further configured to obtain a transmission parameter input by a user; and transmitting the target level signal to access equipment through the level signal expansion card according to the transmission parameter.
Other embodiments or specific implementation manners of the serial port multiplexing device of the present invention may refer to the above method embodiments, and are not described herein again.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or system 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 system. Without further limitation, an element defined by the phrases "comprising a," "8230," "8230," or "comprising" does not exclude the presence of other like elements in a process, method, article, or system comprising the element.
The above-mentioned serial numbers of the embodiments of the present invention are only for description, and do not represent the advantages and disadvantages of the embodiments.
Through the above description of the embodiments, those skilled in the art will clearly understand that the method of the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but in many cases, the former is a better implementation manner. Based on such understanding, the technical solutions of the present invention may be embodied in the form of a software product, which is stored in a storage medium (e.g., a rom/ram, a magnetic disk, an optical disk) and includes instructions for enabling a terminal device (e.g., a mobile phone, a computer, a server, an air conditioner, or a network device) to execute the method according to the embodiments of the present invention.
The above description is only a preferred embodiment of the present invention, and not intended to limit the scope of the present invention, and all modifications of equivalent structures and equivalent processes, which are made by using the contents of the present specification and the accompanying drawings, or directly or indirectly applied to other related technical fields, are included in the scope of the present invention.

Claims (10)

1. A serial port multiplexing method is characterized by comprising the following steps:
acquiring a model detection signal received by a detection pin in a serial port, and determining the type of an expansion card accessed to the expansion card according to the model detection signal;
and performing function adaptation with the access expansion card according to the type of the expansion card, and performing data communication with external equipment through the access expansion card after the function adaptation is completed.
2. The method of claim 1, wherein the obtaining a model detection signal received by a detection pin in the serial port, and determining the type of the expansion card accessed to the expansion card according to the model detection signal comprises:
acquiring a model detection signal received by a detection pin in a serial port, and determining the number of an expansion card accessed to the expansion card according to the model detection signal;
and determining the expansion card type of the access expansion card according to the expansion card number.
3. The method of claim 1, wherein after obtaining the model detection signal received by the detection pin in the serial port, the method further comprises:
when the model detection signal is an idle signal, judging that the expansion card is not accessed to the serial port; and
and when the serial port does not access the expansion card, entering a standby mode.
4. The method of claim 1, wherein the performing function adaptation with the access expansion card according to the expansion card type and performing data communication with an external device through the access expansion card after the function adaptation is completed comprises:
when the expansion card type is an analog expansion card, the function adaptation is carried out on the expansion card and the analog expansion card;
and after the function adaptation with the analog quantity expansion card is completed, acquiring analog quantity data sent by access equipment through the analog quantity expansion card.
5. The method of claim 1, wherein the performing function adaptation with the access expansion card according to the type of the expansion card and performing data communication with an external device through the access expansion card after the function adaptation is completed, further comprises:
when the expansion card type is an analog expansion card, the function adaptation is carried out on the expansion card and the analog expansion card;
after completing function adaptation with the analog quantity expansion card, acquiring analog quantity parameters input by a user;
and outputting the target analog quantity to the access equipment through the analog quantity expansion card according to the analog quantity parameters.
6. The method of any one of claims 1 to 5, wherein the performing function adaptation with the access expansion card according to the type of the expansion card, and performing data communication with an external device through the access expansion card after the function adaptation is completed, comprises:
when the expansion card type is a level signal expansion card, the function adaptation is carried out on the expansion card with the level signal expansion card;
after the level signal expansion card completes functional adaptation, converting the level signal output by the serial port into a target level signal through the level signal expansion card;
and transmitting the target level signal to access equipment through the level signal expansion card.
7. The method of claim 6, wherein said transmitting said target level signal to an access device via said level signal expansion card comprises:
acquiring transmission parameters input by a user;
and transmitting the target level signal to access equipment through the level signal expansion card according to the transmission parameter.
8. A serial port multiplexing device, comprising:
the detection module is used for acquiring a model detection signal received by a detection pin in the serial port and determining the type of an expansion card accessed to the expansion card according to the model detection signal;
and the function adapting module is used for carrying out function adaptation with the access expansion card according to the type of the expansion card and carrying out data communication with external equipment through the access expansion card after the function adaptation is finished.
9. A serial port multiplexing device, comprising: a memory, a processor and a serial multiplexing program stored on the memory and executable on the processor, the serial multiplexing program being configured to implement the steps of the serial multiplexing method as claimed in any one of claims 1 to 7.
10. A storage medium, wherein a serial port multiplexing program is stored on the storage medium, and when being executed by a processor, the serial port multiplexing program implements the steps of the serial port multiplexing method according to any one of claims 1 to 7.
CN202211373470.3A 2022-11-03 2022-11-03 Serial port multiplexing method, device, equipment and storage medium Pending CN115687215A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211373470.3A CN115687215A (en) 2022-11-03 2022-11-03 Serial port multiplexing method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211373470.3A CN115687215A (en) 2022-11-03 2022-11-03 Serial port multiplexing method, device, equipment and storage medium

Publications (1)

Publication Number Publication Date
CN115687215A true CN115687215A (en) 2023-02-03

Family

ID=85047466

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211373470.3A Pending CN115687215A (en) 2022-11-03 2022-11-03 Serial port multiplexing method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN115687215A (en)

Similar Documents

Publication Publication Date Title
CN108199942B (en) Automobile diagnosis method, device, equipment, system and diagnosis connecting equipment
US10819455B2 (en) Broadcast processing method, non-transitory storage medium, and electronic device
CN101834912A (en) Device for dynamically allocating slave addresses in pair of multistandard serial communications and use method
CN112087354A (en) Communication protocol testing method and device, electronic equipment and storage medium
CN110913450B (en) Control method and device for mobile hotspot, mobile terminal and storage medium
CN107872533B (en) Information-pushing method, device, server and storage medium
WO2018161535A1 (en) Method, apparatus and terminal device for sending broadcast
CN115687215A (en) Serial port multiplexing method, device, equipment and storage medium
CN111538692A (en) Frequency converter system and control method thereof
CN113645088B (en) Automatic regulation method, system, device and medium for network card NCSI signal
CN111885588B (en) Method and device for executing electronic card management service
CN113395345A (en) Network distribution method and device of Internet of things equipment and storage medium
CN106899943A (en) Control broadcast transmission person sends method, device and the terminal device of broadcast message
CN105207854A (en) Multi-terminal concurrent testing system and method
CN103118080B (en) Downloading management method based on Android browser and device
CN219269083U (en) Signal transmission system
CN110427336B (en) CPU link rate configuration method, system, equipment and computer medium
CN110336641B (en) Relay protection test method, relay test equipment, storage medium and device
CN108536482A (en) Using screen method, device, server and storage medium
CN215068223U (en) Frequency converter control system
CN108011941A (en) Content delivery method, device, server and storage medium
CN213426432U (en) Bluetooth headset and bluetooth headset charging bin combined system
CN116208660B (en) Method, device, system, equipment and medium for dynamically connecting remote desktop with cloud server
CN115278649B (en) Telephone number acquisition method, equipment, system and medium based on machine learning
CN116150069A (en) Data processing method, device, equipment and storage medium

Legal Events

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