Summary of the invention
The shortcoming of prior art in view of the above, the object of the present invention is to provide a kind of management system based on serial bus and management method, for solve existing multichannel logical signal configuration underaction, back plate design complexity is high and design cost is high, and the cost of existing serial bus is high, efficiency is low and the problem such as influential system performance.
For achieving the above object and other relevant objects, the invention provides a kind of management system based on serial ports, comprising:
Main control card;
Backboard, communicates to connect described main control card by serial bus; And
Multiple service card, is communicated to connect described backboard by serial bus and is communicated with described main control card by described serial bus, communicates between multiple described service card and described main control card according to setting agreement.
Preferably, described setting agreement comprises the command byte and data byte that sequentially transmit, and described command byte comprises command type information, command address information and service card number information, and described data byte comprises data message.
Preferably, described main control card comprises processing module, and described processing module is built-in with serial ports controller, forms the supervisory instruction of corresponding described setting agreement and described supervisory instruction is sent to described service card through described serial bus by described serial ports controller.
Preferably, be provided with programmed logical module in described service card, described programmed logical module receives described supervisory instruction that described main control card sends and carries out decoding to described supervisory instruction according to described setting agreement and perform described supervisory instruction.
Preferably, described programmed logical module in described service card monitors described serial bus in real time for obtaining described supervisory instruction in time, identifies after described programmed logical module obtains described supervisory instruction to the service card number information in described supervisory instruction:
If the described service card number information service card corresponding with described programmed logical module is consistent, then described programmed logical module performs service card write data or service card sense data according to described supervisory instruction, then continues the described serial bus of monitoring;
If the described service card number information service card corresponding with described programmed logical module is inconsistent, then described programmed logical module performs according to described supervisory instruction the data byte abandoned in described supervisory instruction or terminates described supervisory instruction, then continues the described serial bus of monitoring.
Present invention also offers a kind of management method based on serial ports, comprising:
Main control card and multiple service card are communicated to connect by the serial bus on backboard, makes to be communicated by described serial bus between described main control card and described service card;
Setting agreement is arranged to described serial bus, and described setting agreement is communicated according to described setting agreement with described service card to make described main control card with described service card stored in described main control card.
Preferably, setting agreement is arranged to described serial bus, comprising:
On described serial bus, transmit command byte, described command byte comprises command type information, command address information and service card number information;
Again in described serial bus transmitting data byte so that terminate this communication, described data byte comprises data message.
Preferably, described main control card forms supervisory instruction according to described setting agreement and described supervisory instruction is sent to described service card by described serial bus.
Preferably, in described service card, programmed logical module is set, described programmed logical module be connected with described serial bus and receive the described supervisory instruction that described main control card sends, by described programmed logical module according to described setting agreement, decoding carried out to described supervisory instruction and perform described supervisory instruction.
Preferably, described programmed logical module in described service card monitors described serial bus in real time, and obtain the described supervisory instruction that described serial bus transmits in time, after described programmed logical module obtains described supervisory instruction, the service card number information in described supervisory instruction is identified:
If the described service card number information service card corresponding with described programmed logical module is consistent, then described programmed logical module performs service card write data or service card sense data according to described supervisory instruction, then continues the described serial bus of monitoring;
If the described service card number information service card corresponding with described programmed logical module is inconsistent, then described programmed logical module performs according to described supervisory instruction the data byte abandoned in described supervisory instruction or terminates described supervisory instruction, then continues the described serial bus of monitoring.
As mentioned above, the management system based on serial ports of the present invention and management method, have following beneficial effect:
Management system based on serial ports of the present invention and management method, completing an instruction only needs two string bytes, has efficiency high; Setting agreement is succinct, and the state machine of service card programmed logical module realizes, and reliability is high; Service card does not need to use application specific standard serial port protocol conversion equipment (as MCU), reduces hardware cost and software development cost; Define service card number information in setting agreement, support that multichannel is accessed from serial ports.
Embodiment
Below by way of specific instantiation, embodiments of the present invention are described, those skilled in the art the content disclosed by this instructions can understand other advantages of the present invention and effect easily.The present invention can also be implemented or be applied by embodiments different in addition, and the every details in this instructions also can based on different viewpoints and application, carries out various modification or change not deviating under spirit of the present invention.It should be noted that, when not conflicting, the feature in following examples and embodiment can combine mutually.
It should be noted that, the diagram provided in following examples only illustrates basic conception of the present invention in a schematic way, then only the assembly relevant with the present invention is shown in graphic but not component count, shape and size when implementing according to reality is drawn, it is actual when implementing, and the kenel of each assembly, quantity and ratio can be a kind of change arbitrarily, and its assembly layout kenel also may be more complicated.
Refer to Fig. 4, the invention provides a kind of management system based on serial ports, main control card uses serial bus to communicate with service card as core bus structure, serial bus Physical layer uses serial ports standard format, the upper-layer protocol of serial bus uses self-defining setting agreement succinctly to complete communication, and utilize this setting agreement to communicate, making the present invention complete an instruction only needs two serial ports access bytes, have both the succinct easily extensible design of backboard, there is again high efficiency feature.On hardware configuration, main control card uses the serial ports controller of CPU module as master control, service card is simple owing to setting agreement, do not need to use serial port protocol conversion equipment, only adopt programmed logical module to do simple state machine and can complete Control on Communication, both reduced hardware cost, also reduced software development cost, there is good economic benefit.Below in conjunction with accompanying drawing, the management system that the present invention is based on serial ports is described.
As shown in Figure 4, the management system that the present invention is based on serial ports comprises main control card 10, backboard 20, and multiple service card, service card comprises service card 41 to service card 4n, wherein n be greater than 1 positive integer, the interface of backboard 20 adopts serial ports, utilize serial ports as the backplane interface of the low speed low data bulk board supervisory signal of management system, this backboard 20 is by serial bus communication connection main control card 10, service card 41 to service card 4n is by serial bus communication connection backboard 20, service card 41 to service card 4n is communicated with main control card 10 by serial bus, serial ports upper-layer protocol between service card 41 to service card 4n and main control card 10 adopts self-defining setting agreement succinctly, make to communicate according to setting agreement between service card 41 to service card 4n and main control card 10.
The main control card 10 that the present invention is based in the management system of serial ports comprises processing module 101, this processing module 101 is CPU module, processing module 101 is built-in with serial ports controller, forms the supervisory instruction of corresponding setting agreement and supervisory instruction is sent to service card 41 to service card 4n through serial bus 30 by serial ports controller.This main control card 10 sends instruction by serial bus 30, further, main control card 30 as control end by processing module 101, is completed by using the built-in serial ports controller of processing module 101 and issues and state acquisition the control command of service card 41 to service card 4n.The Physical layer of this serial ports controller uses standard 8bit mode transfer, and each transmission 8bit data, each 8bit data sent are a byte.
The present invention is based in service card 41 to the service card 4n in the management system of serial ports and be provided with programmed logical module 411,41n, the instruction that service card uses programmed logical module parsing main control card 10 to send also responds, this programmed logical module adopts and writes state machine, receive the supervisory instruction that serial bus 30 sends, decoding is carried out to supervisory instruction and performs this supervisory instruction, complete the communication between main control card 10 and service card, what realize main control card 10 pairs of service cards issues control and state acquisition.Decoding module, channel control module and I2C is included from EM equipment module in programmed logical module, agreement decoding and the response of serial ports is realized by programmed logical module, instruction is read to this board when programmed logical module decoding is found to be, corresponding service card output signal 412,4n2 are sent to main control card 10 by serial bus 30, when for write command to this board, corresponding data information is write the port of corresponding service card input signal 413,4n3.
The setting agreement that the present invention is based in the management system of serial ports adopts self-defining succinct agreement, this setting agreement comprises the command byte and data byte that sequentially transmit, command byte wherein sends to service card 41 to service card 4n by main control card 10, and data byte is follow hard on a command byte byte below, if command byte is write order, this data byte sends to service card 41 to service card 4n by main control card 10, if command byte is read command, this data byte by service card 41 to service card 4n loopback to main control card 10.Because serial ports adopts 8bit standard transmission pattern, the data width of command byte of the present invention and data byte is all 8, command byte comprises command type information, command address information and service card number information, specific coding form is in table 1, data byte comprises data message, and its coded format is in table 2.
Table 1: command byte form
Table 2: data byte form
Service card slot information in table 1 is service card number information, for identifying the service card that this command byte will control.Flow process when communicating according to setting agreement as shown in Figure 5, first send command byte, now send command byte to service card by main control card 10, through serial bus 30, command byte is sent to each service card, the programmed logical module of each service card receives command byte, learn read command or write order for first by command byte, if read command, then which service card needs fill order according to the 5th to the 8th judgement, then according to obtaining second to the service card data access address position on the 4th, the data message on this address bit is sent to main control card 10 as data byte, if write order, then which service card needs fill order according to the 5th to the 8th judgement, then according to obtaining second to the service card data access address position on the 4th, then data byte is write on this address bit.The transmission completing two bytes just completes a protocol instructions afterwards.
As shown in Figure 4 and Figure 6, processing module 101 in main control card 10 starts a protocol instructions needs the serial ports of two bytes to access, that is the supervisory instruction that processing module 101 correspondence setting agreement is formed comprises two bytes, command byte and data byte respectively, command byte be main control card 10 on serial bus 30 transmitting order to lower levels to service card, classify according to the command type information in command byte, if command type information is write order, then main control card 10 then command byte on serial bus 30, issue data byte, if command type information is read command, then main control card 10 then receives the data of a byte on serial bus 30, after these two bytes, main control card 10 completes a complete instruction cycle.
As shown in figs. 4 and 7, the instruction of service card realizes being realized by programmed logical module, and this programmed logical module adopts writes state machine realization, and its process realized is, input in the real-time monitoring serial port bus 30 of programmed logical module in each service card, for the command byte obtained in time in supervisory instruction, this order is resolved after obtaining command byte, service card number information in command byte is identified: if this service card corresponding with programmed logical module of the service card number information in command byte is consistent, then perform service card write data or service card sense data according to this command byte, namely judge that the first byte of command byte is that write order is still as read command, if write order, it is exactly the write order of this service card, according to the address bit in command byte, the data byte that the next one receives is write the data-interface of this address bit definition, terminate this instruction and continue monitoring serial port bus 30, if read command, be exactly the read command of this service card, according to the address bit in command byte, the data-interface state defined by this address bit is stored in after serial bus 30 transmitter register, by serial ports, this data byte is sent to main control card 10, terminate this instruction and continue monitoring serial port bus 30.If this service card corresponding with programmed logical module of the service card number information in command byte is inconsistent, programmed logical module performs according to command byte the data byte abandoned subsequently or terminates this supervisory instruction, if wherein command byte write order, it is just the write order of non-service card, abandon after then receiving next data byte, then receive this instruction and continue monitoring serial port bus 30, if command byte read command, then directly receive this instruction and continue monitoring serial port bus 30.
Present invention also offers a kind of management method based on serial ports, below the management method that the present invention is based on serial ports is described.
As shown in Figure 4, the management method that the present invention is based on serial ports comprises: main control card 10 and multiple service card (i.e. service card 41 to service card 4n) are communicated to connect by the serial bus 30 on backboard 20, make to be communicated by serial bus 30 between main control card 10 and multiple service card; Setting agreement is arranged to serial bus 30, and by setting agreement stored in main control card 10 and multiple service card to make main control card 10 communicate according to setting agreement with multiple service card.Use serial bus 30 as backboard 20 bus interface, realize main control card 10 to be communicated by serial bus 30 with service card, and upper-layer protocol adopts self-defining setting agreement succinctly to complete communication, communication instruction between main control card 10 and service card only needs two serial ports byte-accessed interfaces, have both the succinct easily extensible design of backboard 20, there is again high efficiency feature.
As shown in Figure 5, the setting agreement that the present invention is based in the management method of serial ports comprises the command byte and data byte that sequentially transmit, the form of command byte and data byte is shown in table 1 above and table 2, below the flow process of setting agreement is described, the process completing a protocol instructions according to setting agreement comprises the steps: that first performing step S11 starts, then step S12 is performed after starting protocol instructions, perform step S12, send command byte, upload at serial bus 30 and send command byte, then step S13 is performed after sending command byte, perform step S13, send data byte, serial bus 30 transmits data byte, then step S14 is performed, perform step S14 and terminate this protocol instructions, a protocol instructions is just completed like this by transmit command byte and data byte on serial bus 30 after, agreement is succinctly simple, efficiency is high.Command byte in setting agreement comprises command type information, command address information and service card number information, and data byte comprises data message.
As shown in Figure 4 and Figure 6, the flow process that main control card completes a protocol instructions is as follows: step S11 starts, then step S12 command byte is performed, main control card 10 is now had to send command byte to service card, through serial bus 30, command byte is sent to each service card, the programmed logical module of each service card receives command byte, learn read command or write order for first by command byte, if read command, then which service card needs fill order according to the 5th to the 8th judgement, then according to obtaining second to the service card data access address position on the 4th, perform step S13, the data message on this address bit is sent to main control card 10 as data byte, if write order, then which service card needs fill order according to the 5th to the 8th judgement, then according to obtaining second to the service card data access address position on the 4th, perform step S13, then data byte is write on this address bit.Then perform step S14 to terminate, the transmission completing two bytes just completes an instruction afterwards.
As shown in figs. 4 and 7, in service card, programmed logical module is set, programmed logical module is connected with serial bus 30 and receives the supervisory instruction that main control card 10 sends, by programmed logical module, supervisory instruction is carried out to decoding according to setting agreement and performed supervisory instruction, command byte in supervisory instruction can be resolved by this programmed logical module of setting agreement, then the order of resolving is performed.The flow process that concrete programmed logical module completes an instruction comprises the steps:
Perform step S301, start, after starting, then perform step S302;
Perform step S302, monitoring serial port receives, the input of the real-time monitoring serial port bus 30 of programmed logical module, to obtain command byte in time, receive according to monitoring serial port and judge, if countless according to input, then then perform step S313, if there are data to input, then then perform step S303;
Perform step S303, serial ports receives command byte and judges, judges command type information by the first byte of the command byte received, if command type information is write order, then then perform step S304, if command type information is read command, then then perform step S305;
Perform step S304, determine whether this service card, judged by the service card number information in command byte, if consistent with this service card, be then this service card, then perform step S307, if inconsistent with this service card, then not this service card, then perform step S306;
Performing step S307, is after the write order of this service card, and locking reference address position, obtains address bit according to command byte, then performs step S308;
Perform step S308, serial ports receives data byte, and command byte is write order, and this command byte is sent by main control card with the data byte that followed by, and then performs step S309;
Perform step S309, by data byte writing address position definition signal interface, by the address bit that the data byte write step S307 received in step S308 obtains, then perform step S313;
Perform step S306, serial ports receives data byte, and this command byte is not the write order of this service card, abandons after receiving data byte, then then performs step S313;
Perform step S305, determine whether this service card, judge whether read command is this service card, being judged by the service card number information in command byte, if consistent with this service card, is then this service card, then step S310 is performed, if inconsistent with this service card, then not this service card, then perform step S313;
Performing step S310, is after the read command of this service card, and locking reference address position, obtains address bit according to command byte, then performs step S311;
Perform step S311, by address bit definition signal state stored in serial ports transmitter register, command byte is read command, and this command byte is sent by service card with the data byte that followed by, and then performs step S312;
Perform step S312, serial ports transmitter register data are sent from serial ports, the signal condition that the address bit obtained in step S310 defines is sent to main control card, then perform step S313;
Perform step S313, terminate this instruction.
In sum, the present invention is based on management system and the management method of serial ports, achieve the command communication between main control card and service card, complete an instruction and only need two serial ports bytes, efficiency is high, and setting agreement is succinct, the state machine of service card programmed logical module can realize, and reliability is high.Service card does not need to use application specific standard serial port protocol conversion equipment, reduces hardware cost and software development cost, and setting agreement defines slot information, supports that multichannel is accessed from serial ports.So the present invention effectively overcomes various shortcoming of the prior art and tool high industrial utilization.
Above-described embodiment is illustrative principle of the present invention and effect thereof only, but not for limiting the present invention.Any person skilled in the art scholar all without prejudice under spirit of the present invention and category, can modify above-described embodiment or changes.Therefore, such as have in art usually know the knowledgeable do not depart from complete under disclosed spirit and technological thought all equivalence modify or change, must be contained by claim of the present invention.