CN107391417A - A kind of method of multiplexing serial port - Google Patents
A kind of method of multiplexing serial port Download PDFInfo
- Publication number
- CN107391417A CN107391417A CN201710658035.8A CN201710658035A CN107391417A CN 107391417 A CN107391417 A CN 107391417A CN 201710658035 A CN201710658035 A CN 201710658035A CN 107391417 A CN107391417 A CN 107391417A
- Authority
- CN
- China
- Prior art keywords
- mcu
- serial
- outside
- port
- main
- 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
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F13/00—Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
- G06F13/38—Information transfer, e.g. on bus
- G06F13/40—Bus structure
- G06F13/4004—Coupling between buses
- G06F13/4022—Coupling between buses using switching circuits, e.g. switching matrix, connection or expansion network
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F13/00—Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
- G06F13/38—Information transfer, e.g. on bus
- G06F13/42—Bus transfer protocol, e.g. handshake; Synchronisation
- G06F13/4282—Bus transfer protocol, e.g. handshake; Synchronisation on a serial bus, e.g. I2C bus, SPI bus
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Mathematical Physics (AREA)
- Computer Hardware Design (AREA)
- Small-Scale Networks (AREA)
Abstract
The embodiment of the present invention provides a kind of method of multiplexing serial port.By serial port-shaped as network connection, with the multiplexing serial port of different baud rate serial communications, with the multiplexing serial port of different pieces of information bag header data serial communication, with the multiplexing serial port of programme-control serial ports circuit, with the multiplexing serial port of MCU power supplys supply outside programme-control, or the method for these multiplexing serial ports can two or three or four composition combination applications.Meanwhile in order to solve the MCU of different manufacturers composition isomery serial networks, the serial communication circuit can connect the suitable resistance of resistance, or/and the suitable pull-up resistor of serial communication connection resistance.The present embodiment is substantially improved serial port resource utilization rate, is reduced serial port resource and waste and reduce cost by multiplexing serial port.
Description
Technical field
The present invention relates to the method for electronic communication field, more particularly to multiplexing serial port.
Background technology
Electronic equipment is equipped with MCU.
Because serial port communication technology is mature and stable, it is widely used, takes the MCU advantage such as I/O resource is few, at present main flow MCU
Between communicate and all recommend serial communication.
However, when main control MCU is connected with outside multiple serial port modules, traditionally consider that communication is dry between avoiding serial ports
Disturb, it is desirable to which each outside serial ports monopolizes serial port resource, so requires main control MCU there are enough multi-serial port resource connections outside
Serial ports.In fact, MCU serial port resource is very limited amount of, most of low and middle-end MCU only has 1 or 2 serial port resources can
Used for outside serial ports.In order to support more outside serial communications, it has to increase MCU to realize, so as to increase cost.
In fact, the call duration time of MCU and outside serial ports is less than 1%, that is to say, that 99% time is idle, and its is only
During the serial port resource accounted for is in idle.
The content of the invention
In consideration of it, the embodiment of the present invention provides a kind of method of multiplexing serial port.
In the method for the multiplexing serial port of different baud rate serial communications, including:
It is in Star Network that main MCU is connected with least one outside MCU serial ports;
Main MCU sending port Tx and outside MCU receiving port Rx are connected, and main MCU receiving port Rx and outside MCU
Receiving port Tx connections;
Main MCU is identical with outside MCU serial port communication data bag header data, and bag mantissa is according to also identical;
Main MCU carries out serial communication from each outside MCU with different baud rates.
In the method for the multiplexing serial port of different pieces of information bag header data serial communication, including:
It is in Star Network that main MCU is connected with least one outside MCU serial ports;
Main MCU sending port Tx and outside MCU receiving port Rx are connected, and main MCU receiving port Rx and outside MCU
Receiving port Tx connections;
Main MCU and outside MCU carries out serial communication with identical baud rate;
Main MCU is different from header data during each outside MCU serial communications, and the outside MCU determines data by header data
Bag purpose recipient, the processing data bag if the outside MCU is exactly purpose recipient, if the outside MCU is not mesh
Recipient's then packet discard.
In the method for the multiplexing serial port of programme-control serial ports circuit, including:
It is in Star Network that main MCU is connected with least one outside MCU serial ports;
Main MCU sending port Tx and outside MCU receiving port Rx are connected, and main MCU receiving port Rx and outside MCU
Receiving port Tx connections;
The serial port connecting wire road determines circuit closure by program switch or opened;
Serial ports control module control described program switch closure is opened;
If program switch corresponding to serial ports control module to an outside MCU exports closure signal, main MCU and the outside
MCU serial ports circuit connection, and start normal serial communication;If program corresponding to serial ports control module to the outside MCU
Signal is opened in switch output, then main MCU and the outside MCU serial ports circuit disconnect, and interrupt serial communication.
In the method for the multiplexing serial port of MCU power supplys supply outside programme-control, including:
It is in Star Network that main MCU is connected with least one outside MCU serial ports;
Main MCU sending port Tx and outside MCU receiving port Rx are connected, and main MCU receiving port Rx and outside MCU
Receiving port Tx connections;
The outside MCU determines that whether power supply is supplied by program switch;
Serial ports control module control described program switch closure is opened;
If program switch corresponding to serial ports control module to an outside MCU exports closure signal, the outside MCU is obtained
Power supply is supplied and starts work, and starts normal serial communication;If program corresponding to serial ports control module to the outside MCU
Signal is opened in switch output, then the outside MCU is terminated power supply and supplied and power cut-off, and interrupts serial communication.
Further, the method for the multiplexing serial port can two or three or four composition combination applications.
Further, the serial communication circuit series connection suitable resistance of resistance.
Further, the suitable pull-up resistor of serial communication connection resistance.
Serial port resource utilization rate is substantially improved by multiplexing serial port in the present embodiment, reduce serial port resource waste and reduce into
This.
Brief description of the drawings
In order to illustrate more clearly about the embodiment of the present invention or technical scheme of the prior art, below will be to embodiment or existing
There is the required accompanying drawing used in technology description to be briefly described, it should be apparent that, drawings in the following description are only this
Some embodiments of invention, for those of ordinary skill in the art, on the premise of not paying creative work, can be with
Other accompanying drawings are obtained according to these accompanying drawings.
Fig. 1 is this method multiplexing serial port Star Network circuit diagram.
Fig. 2 is the flow chart of embodiments of the invention one.
Fig. 3 is the flow chart of embodiments of the invention two.
Fig. 4 is the flow chart of embodiments of the invention three.
Fig. 5 is the flow chart of embodiments of the invention four.
Fig. 6 is the circuit diagram of embodiments of the invention three.
Fig. 7 is the circuit diagram of embodiments of the invention four.
Fig. 8 is the circuit diagram of embodiments of the invention serial ports circuit series resistance.
Fig. 9 is the circuit diagram that embodiments of the invention serial ports circuit connects pull-up resistor.
Embodiment
Below in conjunction with the accompanying drawing in the embodiment of the present invention, the technical scheme in the embodiment of the present invention is carried out clear, complete
Site preparation describes, it is clear that described embodiment is only part of the embodiment of the present invention, rather than whole embodiments.It is based on
Embodiment in the present invention, those of ordinary skill in the art are obtained every other under the premise of creative work is not made
Embodiment, belong to the scope of protection of the invention.
Multiplexing serial port method of the invention, it is that star-like communication network is formed based on main MCU and multiple outside MCU such as Fig. 1
Structure, i.e., outside MCU can only communicate with main MCU, and can not be communicated between outside MCU.
As shown in figure 1, main MCU receiving port Rx is connected with all outside MCU sending port Tx, main MCU transmission
Port Tx is connected with all outside MCU receiving port Rx.
Embodiment one:
Set each outside MCU serial communication baud rate different on main MCU, but communication data packet packet header and bag tail are identical.
For example, outside MCU is MCU-1, MCU-2, MCU-3 ... ... respectively, and MCU-n, the serial communication baud between main MCU and MCU-1
Rate is 9600 bps, and serial communication baud rate between main MCU and MCU-2 is 19200 bps, main MCU and MCU-1 it
Between serial communication baud rate be 28800 bps ... ...
Main MCU and outside MCU communication protocols explicit data bag are by packet header and bag caudal knot beam, such as packet header and bag tail are all
0xEF02, then first 0xEF02 is detected during received data packet and represents that packet starts, number when being arrived to next 0xEF02
According to end-of-packet.
Because main MCU and any one outside MCU serial communications baud rate are all different, then only purposeful MCU can be decoded
Packet header and bag tail 0xEF02 are obtained, i.e., only purposeful MCU can be normally received and be decoded the packet of main MCU serial communications.
Because all outside MCU sending port Tx is interconnected, and it is connected with main MCU receiving ports Rx, as outside MCU
Packet is sent, only main MCU can receive packet.
Embodiment two:
Each outside MCU is set to use identical serial communication baud rate on main MCU, but communication data packet packet header and bag tail are not
Together.For example, outside MCU is MCU-1, MCU-2, MCU-3 ... ... respectively, and MCU-n, serial communication between main MCU and outside MCU
Using identical 9600 bps of baud rate, while consult the packet header of communication data packet and bag tail between main MCU and MCU-1 and be
0xEF01, the packet header of communication data packet and bag tail are 0xEF02 between main MCU and MCU-2, and communicate number between main MCU and MCU-3
It is 0xEF03 ... ... according to the packet header of bag and bag tail
Because main MCU is identical with all outside MCU serial communication baud rates, then when the serial data that main MCU is sent, all outsides
MCU can be received and decode in its Rx port.When main MCU sends the packet in 0xEF01 packet header, described in only MCU-1 processing
Packet, other outside MCU judge that packet header is not belonging to oneself and abandon the packet.So now only have
MCU-1 and main MCU carries out normal serial communication.
Because all outside MCU sending port Tx is interconnected, and it is connected with main MCU receiving ports Rx, as outside MCU
Packet is sent, only main MCU can receive packet.
Embodiment three:
Such as Fig. 6, the serial communication circuit between main MCU and outside MCU is controlled by program switch to be closed, and wherein program switch is controlled
In serial ports control module.For example, during serial ports control module S1 port output signal high level, program switch corresponding to MCU-1 closes
Close, then MCU-1 and main MCU serial communication connection;And during S1 port output signal low levels, program corresponding to MCU-1
Switch opens, then MCU-1 and main MCU serial communication circuit disconnects.Then, when S1, S2, S3, S4 level signal are respectively
When high and low, low, low, only MCU-1 and main MCU serial communication line vias, and it is normally carried out serial communication.
Communication steps are as follows:
Step 401, serial ports control module enables switchs corresponding to the outside MCU communication paths, connects the communication path;
Step 402, serial ports control module is closed switchs corresponding to the outside MCU communication paths, disconnects the communication path.
Example IV:
Such as Fig. 7, outside MCU working powers are controlled by program switch and closed, and wherein program switch is controlled by serial ports control module.Example
Such as, during serial ports control module S1 port output signal high level, program switch corresponding to MCU-1 closes, then MCU-1 obtains electricity
Source is supplied and starts work, and the MCU-1 and main MCU serial communication recovers normal;During S1 port output signal low levels,
Program switch corresponding to MCU-1 opens, then MCU-1 power supplys are cut off and no longer worked, and the MCU-1 and main MCU serial ports lead to
Believe failure.Then, when S1, S2, S3, S4 level signal are high and low, low, low respectively, only MCU-1 is working properly,
And it is normally carried out serial communication with main MCU.
Communication steps are as follows:
Step 501, serial ports control module enables the outside MCU module power supply, makes the outside MCU normal works;
Step 502, serial ports control module closes the outside MCU module power supply, the outside MCU module is not worked.
Obviously, can be applied between the embodiment of the inventive method with flexible combination, such as embodiment one and embodiment
Two combine application, embodiment three and example IV combine using, etc., those skilled in the art can be easily
Expect the advantage that various compositions are brought and be applied, but this is all within the scope of the present invention.
In actual applications, when each MCU of composition serial ports Star Network is not belonging to same producer, its Serial technology
May be different, in consideration of it, the present embodiment suggestion:(One)It is suitably electric in one resistance of each serial communication circuit series connection
Resistance, such as 1K ohms, to prevent the MCU of connection is idle serial ports Rx and Tx ports are grounded;(Two)In serial communication circuit
The suitable pull-up resistor of resistance, such as 100k ohms are connect, so that serial ports Rx and Tx ports are connect so that the MCU for preventing from connecting is idle
Ground.
The foregoing is only a specific embodiment of the invention, but protection scope of the present invention is not limited thereto, any
Those familiar with the art the invention discloses technical scope in, change or replacement can be readily occurred in, should all be contained
Cover within protection scope of the present invention.Therefore, protection scope of the present invention should be based on the protection scope of the described claims.
Claims (7)
- A kind of 1. method of multiplexing serial port, it is characterised in that including:It is in Star Network that main MCU is connected with least one outside MCU serial ports;Main MCU sending port Tx and outside MCU receiving port Rx are connected, and main MCU receiving port Rx and outside MCU Receiving port Tx connections;Main MCU is identical with outside MCU serial port communication data bag header data, and bag mantissa is according to also identical;Main MCU carries out serial communication from each outside MCU with different baud rates.
- A kind of 2. method of multiplexing serial port, it is characterised in that including:It is in Star Network that main MCU is connected with least one outside MCU serial ports;Main MCU sending port Tx and outside MCU receiving port Rx are connected, and main MCU receiving port Rx and outside MCU Receiving port Tx connections;Main MCU and outside MCU carries out serial communication with identical baud rate;Main MCU is different from header data during each outside MCU serial communications, and the outside MCU determines data by header data Bag purpose recipient, the processing data bag if the outside MCU is exactly purpose recipient, if the outside MCU is not mesh Recipient's then packet discard.
- A kind of 3. method of multiplexing serial port, it is characterised in that including:It is in Star Network that main MCU is connected with least one outside MCU serial ports;Main MCU sending port Tx and outside MCU receiving port Rx are connected, and main MCU receiving port Rx and outside MCU Receiving port Tx connections;The serial port connecting wire road determines circuit closure by program switch or opened;Serial ports control module control described program switch closure is opened;If program switch corresponding to serial ports control module to an outside MCU exports closure signal, main MCU and the outside MCU serial ports circuit connection, and start normal serial communication;If program corresponding to serial ports control module to the outside MCU Signal is opened in switch output, then main MCU and the outside MCU serial ports circuit disconnect, and interrupt serial communication.
- A kind of 4. method of multiplexing serial port, it is characterised in that including:It is in Star Network that main MCU is connected with least one outside MCU serial ports;Main MCU sending port Tx and outside MCU receiving port Rx are connected, and main MCU receiving port Rx and outside MCU Receiving port Tx connections;The outside MCU determines that whether power supply is supplied by program switch;Serial ports control module control described program switch closure is opened;If program switch corresponding to serial ports control module to an outside MCU exports closure signal, the outside MCU is obtained Power supply is supplied and starts work, and starts normal serial communication;If program corresponding to serial ports control module to the outside MCU Signal is opened in switch output, then the outside MCU is terminated power supply and supplied and power cut-off, and interrupts serial communication.
- 5. the method for multiplexing serial port according to claims 1 to 4, it is characterised in that including:The multiplexing serial port method can two or three or four composition combination applications.
- 6. the method for the multiplexing serial port according to any claim in Claims 1 to 5, it is characterised in that including:The serial ports circuit series connection suitable resistance of resistance.
- 7. the method for the multiplexing serial port according to any claim in claim 1~6, it is characterised in that including:The suitable pull-up resistor of serial ports connection resistance.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710658035.8A CN107391417A (en) | 2017-08-03 | 2017-08-03 | A kind of method of multiplexing serial port |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710658035.8A CN107391417A (en) | 2017-08-03 | 2017-08-03 | A kind of method of multiplexing serial port |
Publications (1)
Publication Number | Publication Date |
---|---|
CN107391417A true CN107391417A (en) | 2017-11-24 |
Family
ID=60343858
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201710658035.8A Pending CN107391417A (en) | 2017-08-03 | 2017-08-03 | A kind of method of multiplexing serial port |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN107391417A (en) |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101500331A (en) * | 2008-02-02 | 2009-08-05 | 中兴通讯股份有限公司 | Method and mobile terminal for time division multiplexing serial port |
CN106549881A (en) * | 2015-09-17 | 2017-03-29 | 中兴通讯股份有限公司 | The changing method of multiple processor serial port multiplexings, apparatus and system on a kind of veneer |
CN106776410A (en) * | 2016-12-07 | 2017-05-31 | 深圳市科陆物联信息技术有限公司 | A kind of handheld terminal with serial ports |
-
2017
- 2017-08-03 CN CN201710658035.8A patent/CN107391417A/en active Pending
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101500331A (en) * | 2008-02-02 | 2009-08-05 | 中兴通讯股份有限公司 | Method and mobile terminal for time division multiplexing serial port |
CN106549881A (en) * | 2015-09-17 | 2017-03-29 | 中兴通讯股份有限公司 | The changing method of multiple processor serial port multiplexings, apparatus and system on a kind of veneer |
CN106776410A (en) * | 2016-12-07 | 2017-05-31 | 深圳市科陆物联信息技术有限公司 | A kind of handheld terminal with serial ports |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN100438517C (en) | Family gateway equipment | |
CN101984606A (en) | Device-level redundancy protection method and system based on LACP | |
CN103179178B (en) | The method and apparatus of aggregation group member port between extension cluster | |
CN103401707B (en) | link aggregation method and access device | |
CN102523113B (en) | Chip realization method for MEP configuration on cross-chip aggregated link in Ethernet network OAM and chip realization system | |
CN103036728A (en) | Multi- redundancy ethernet data transmission system and transmission method | |
CN101313481A (en) | Method and apparatus using back board service bus for service transmission | |
CN110011912A (en) | Case type switching equipment uplink switching method and device | |
CN105530205B (en) | Microwave equipment convergence device and method | |
CN107181702B (en) | Device for realizing RapidIO and Ethernet fusion exchange | |
CN107391417A (en) | A kind of method of multiplexing serial port | |
CN101582892B (en) | Link negotiation method based on fiber channel aggregate port and device | |
CN113891537B (en) | Method, device and medium for timing logic through computer analog digital dimming protocol | |
CN202795352U (en) | Wiring method for recommend standard (RS) 232 interface and RS 485 interface | |
CN105009512A (en) | Method, device, and system for configuring maintenance association (MA) | |
Cisco | Configuring Interfaces | |
CN107294824A (en) | Customer terminal equipment | |
CN208079287U (en) | A kind of communication manager | |
CN209447019U (en) | RS485 equipment connects circuit and system | |
Cisco | Cisco IOS Interface Configuration Guide Release 12.2 | |
Cisco | Configuring Interfaces | |
Cisco | Configuring Interfaces | |
Cisco | Configuring Interfaces | |
Cisco | Configuring Interfaces | |
CN209330153U (en) | A kind of optical port bypass interchanger |
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 | ||
WD01 | Invention patent application deemed withdrawn after publication | ||
WD01 | Invention patent application deemed withdrawn after publication |
Application publication date: 20171124 |