Embodiment
For making the object of the embodiment of the present invention, technical scheme and advantage clearly, below in conjunction with the accompanying drawing in the embodiment of the present invention, technical scheme in the embodiment of the present invention is clearly and completely described, obviously, described embodiment is the present invention's part embodiment, instead of whole embodiments.The element described in an accompanying drawing of the present invention or a kind of execution mode and feature can combine with the element shown in one or more other accompanying drawing or execution mode and feature.It should be noted that for purposes of clarity, accompanying drawing and eliminate expression and the description of unrelated to the invention, parts known to persons of ordinary skill in the art and process in illustrating.Based on the embodiment in the present invention, the every other embodiment that those of ordinary skill in the art obtain under the prerequisite not paying creative work, all belongs to the scope of protection of the invention.
Embodiment one:
The invention provides a kind of multi-channel intelligent Serial Communication Card, its structure chart as shown in Figure 1, comprising: FPGA, transmission path gating module and receiving path gating module;
Wherein,
Described transmission path gating module comprises multiple sendaisle;
Described receiving path gating module comprises multiple receive path;
Described FPGA is connected with described receiving path gating module with described transmission path gating module respectively, forms loop detection function.
The present invention by communication least significant end by FPGA respectively with transmission path gating module with accept path gating module and be connected and define one-level interchannel closed loop, achieve self-checking function, ensure that intelligent serial port board is under any one communication pattern, transmission and the reception of any passage can be traversed, by FPGA (Field-Programmable Gate Array, field programmable gate array) carrying out simply programming just to judge rapidly out of order pattern and the passage broken down and corresponding port, do not need the self-inspection that can complete self multiple sendaisle and multiple receive path at the outside lead of communication card or the testing equipment that connects other.
Described multi-channel intelligent Serial Communication Card also comprises: multiplexer switch, described multiplexer switch is connected to described transmission path gating module and describedly accepts between path gating module, accepts the address of passage for the address of described sendaisle of the signal acquisition conducting based on described FPGA and the described of conducting.
Above-mentioned transmission path gating module and receiving path gating module have 8 sendaisles and 8 receive paths respectively, and above-mentioned 8 sendaisles and 8 receive paths can carry out having switched to carry out self-inspection to multi-channel intelligent Serial Communication Card under arbitrary patterns.
8 above-mentioned sendaisles are connected by multiplexer switch with 8 receive paths, and FPGA realizes the selection for sendaisle and receive path by the different sendaisle address of configuration and receive path address.
Optionally, described to passage intelligence Serial Communication Card also comprise communication pattern select module;
Described communication pattern selects module to be used for selecting described transmission path gating module and the described communication pattern accepting path gating module based on FPGA instruction;
Described communication pattern comprises: RS-232, RS-422, RS-485.
Described FPGA controls by instruction the communication pattern that described communication pattern selects transmission path gating module and described receiving path gating module described in model choice.Communication card in the present invention is multichannel serial communication card, communication pattern comprises above-mentioned three kinds, mode of connection when the carrying out of often kind of communication pattern detects and the external equipment be attached thereto also are not quite similar, in order to can reduce communication card test time mistake and reduce testing cost, the present invention proposes the function increasing loop detection, can judge rapidly which kind of pattern is fault occur in.
According to description above, communication card in the present invention has plurality of communication schemes respectively, and what communication pattern transmission path gating module and receiving path gating module select respectively, by what passage are connected, be all that described FPGA carries out programming selection, pass through compiled program and carry out self-inspection.
Optionally, described FPGA also comprises loop detection enable module, for multiplexer switch described in the control command conducting based on described FPGA.
According to said above, described multiplexer switch is connected between transmission path gating module and receiving path gating module, signal is not sent at FPGA, multiplexer switch described in the non-conducting of described loop detection enable module, when described closed loop self-checking function does not use, do not affect the proper communication of described multi-channel intelligent Serial Communication Card;
When namely FPGA transmission coherent signal needs to use self-checking function, described loop detection enable module controls described multiplexer switch based on the control command of described FPGA, obtain the address of above-mentioned two passages, realize the UNICOM of described transmission path and described receiving path, carry out interchannel self-inspection, the passage broken down can be detected fast; Further, when carrying out interchannel self-inspection, all passages are identical pattern, so can know the pattern broken down simultaneously.
Embodiment two:
As shown in Fig. 2 flow chart, present invention also offers a kind of method of multi-channel intelligent Serial Communication Card being carried out to self-inspection, comprising:
S101: transmission path gating module and receiving path gating module select identical communication pattern;
S102: sendaisle i is routed to transmit port, receive path 0 to receive path M-1 is routed to receiving port in turn, and communication data is sent to receive path 0 to receive path M-1 in turn from sendaisle i, wherein, i is for being more than or equal to zero and being less than N natural number, N is the port number of transmission path gating module, and M is the port number of receiving path gating module;
S103: described communication data is sent and receives test.
Multi-channel intelligent Serial Communication Card in the present invention is by using loop detection function, ensure that intelligent serial port board is under any one communication pattern, transmission and the reception of any passage can be traversed, and judge rapidly out of order pattern and the passage broken down and corresponding port by simple programming, achieve without the need to outside lead and the self-checking function being connected external test facility and namely completing multiple sendaisle and receive path.
Above-mentioned steps S103 specifically comprises: if the transmission of described communication data and reception all make a mistake, and mistake is identical, then described sendaisle i breaks down.
If described communication data occurs test errors when receive path j, then continue test to determine whether described receive path j breaks down, wherein, j is the natural number being more than or equal to zero and being less than M.
Optionally, in order to determine " if described communication data occurs test errors when at receive path j; then continue test to determine whether described receive path j breaks down ", keep described receive path j at receiving port, sendaisle 0 to sendaisle N-1 is routed to transmit port in turn, if the transmission of described communication data and reception all make a mistake, and mistake is identical, then described receive path j breaks down.
Above-mentioned test all will be carried out under described transmission path gating module and described receiving path gating module are in identical communication pattern, in order to complete the self-inspection carried out multi-channel intelligent Serial Communication Card, also need to carry out step S104: the communication pattern changing described transmission path gating module and receiving path gating module, and repeat S102 and S103 under often kind of communication pattern.
Communication card in the present invention has multiple communication pattern, need the communication pattern changing described transmission path gating module and receiving path gating module, repeat the test transmitted and receive data, to determine whether each sendaisle and receive path exist fault under different communication patterns.
Optionally, described communication pattern comprises: RS-232, RS-422, RS-485.
Illustrate the self checking method of described multi-channel intelligent Serial Communication Card below, first FPGA uses loop detection function, then carries out following steps:
1, transmission path gating module and receiving path gating module are all selected setting RS-232 pattern,
2, sendaisle 0 is routed to transmit port,
3, receive path 0 is routed to receiving port,
4, the test transmitted and receive data is carried out subsequently;
If the 5 above-mentioned test results transmitted and receive data are correct, then continue other passage sendaisles and receive path to be routed to transmit port and receiving port; If the test result transmitted and receive data above-mentioned is incorrect, then change the receive path of above-mentioned receiving port, receive path 1-7 is routed to described receiving port respectively, proceed the test transmitted and receive data, if above-mentioned 7 tests all make a mistake, and it is identical to test the error situation occurred when described mistake and receive path 0 are routed to receiving port, then illustrate that, under RS-232 pattern, sendaisle 0 exists fault;
6, determine whether other sendaisles occur mistake, can by changing described sendaisle, described sendaisle 1-7 is routed to transmit port respectively, repeat above-mentioned steps 3-5 again, observe after different sendaisles is routed to transmit port, whether different receive paths there will be identical test errors, if occur, then current sendaisle exists fault;
If for different sendaisles, be all occur test errors when identical receive path, and error situation is identical, then above-mentioned receive path breaks down.
7, changing pattern is subsequently RS-422, and repeats above-mentioned step 2-6, determines under pattern RS-422, there is fault sendaisle and receive path.
8, pattern of changing again is RS-485, repeats above-mentioned steps 2-6, determines under pattern RS-485, there is fault sendaisle and receive path.
In above-mentioned testing process, described FPGA uses loop detection function, when not needing to use loop detection function to be that described multi-channel intelligent Serial Communication Card carries out proper communication.
The method of carrying out self-inspection to multi-channel intelligent Serial Communication Card in the present invention is by increasing above-mentioned loop detection function, by simple programming, transmission and the reception of any passage can be traversed under any one communication pattern, and judge the pattern that breaks down and passage, navigate to transmit port or receiving port simultaneously, avoid the loaded down with trivial details of outer counter multiple wire test, make the judgement of fault more simple and operating mistake can not occur.
State in each embodiment on the invention, the sequence number of embodiment and/or sequencing are only convenient to describe, and do not represent the quality of embodiment.The description of each embodiment is all emphasized particularly on different fields, in certain embodiment, there is no the part described in detail, can see the associated description of other embodiments.
Although last it is noted that described the present invention and advantage thereof in detail above, be to be understood that and can carry out various change when not exceeding the spirit and scope of the present invention limited by appended claim, substituting and converting.And scope of the present invention is not limited only to the specific embodiment of process, equipment, means, method and step described by specification.One of ordinary skilled in the art will readily appreciate that from disclosure of the present invention, can use perform the function substantially identical with corresponding embodiment described herein or obtain and its substantially identical result, existing and that will be developed in the future process, equipment, means, method or step according to the present invention.Therefore, appended claim is intended to comprise such process, equipment, means, method or step in their scope.