Multifunctional serial communication device and method
By designing a multi-functional serial communication device, including an electric serial module, an optical serial module and a control module, the problems of single functions and low integration of existing devices are solved, and multi-functional communication and efficient testing are realized.
Patent Information
- Application Number
- CN202411768846.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-04
- Publication Date
- 2025-04-18
AI Technical Summary
The existing serial communication device has a single function and cannot support the communication between optical and electrical signals at the same time. It has low integration, large size, and long testing process, which brings inconvenience to the testing.
A multifunctional serial communication device is designed, including an electric serial module, an optical serial module and a control module, which can receive and analyze electrical signals and optical signals at the same time, and convert and feedback through corresponding modules.
It realizes multi-function communication, the testing process is simple and convenient, and improves the application scenarios of the communication device, with high integration and small size, making it easy to carry and use.
Smart Images

Figure CN119847962A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the technical field of serial port communication, and in particular to a multifunctional serial port communication method. Background Art
[0002] With the accelerated advancement of the construction of new power systems, the gradual implementation of the construction of intelligent dispatching systems and the high-quality development of distribution networks, smart grid devices are constantly being optimized, and the demand for protection testing is also increasing. When performing protection testing on power systems, it is necessary to use a serial communication device to achieve communication between the device under test and the test device.
[0003] At present, the existing serial communication devices cannot meet the communication requirements of optical signals and optical signals at the same time, and can only realize optical signal communication. The communication method is single and cannot meet the communication requirements of electrical signals of on-site power equipment. There are few application scenarios. In addition, the existing communication devices have low integration, large size, large space occupation, and long testing process, which brings a lot of inconvenience to the testing.
[0004] The existing communication devices have single functions and inconvenient testing processes, which has become a technical problem that needs to be solved urgently in the industry. Summary of the invention
[0005] The present invention provides a multifunctional serial port communication device and method to solve the problems of single function and inconvenient testing process of existing communication devices, thereby realizing multifunctional communication, simplifying and convenient testing process, and improving application scenarios of communication devices.
[0006] According to one aspect of the present invention, there is provided a multifunctional serial port communication device, comprising: an electrical serial port module, an optical serial port module and a control module;
[0007] The electrical serial port module is connected to the control module, and is used to receive the electrical signal of the device under test and convert it into an electrical signal matching the control module and then send it to the control module, and convert the electrical signal output by the control module and then output it to the device under test;
[0008] The optical serial port module is connected to the control module, and is used to receive the optical signal of the device under test and convert the optical signal into an electrical signal and then send it to the control module, and convert the electrical signal output by the control module into an optical signal and then output it to the device under test;
[0009] The control module is used to analyze the electrical signal output by the electrical serial port module and / or the electrical signal output by the optical serial port module, and output a corresponding electrical signal to at least one of the electrical serial port module and the optical serial port module.
[0010] Optionally, the electrical serial port module includes: a Phoenix terminal and a level selection conversion circuit;
[0011] The Phoenix terminal is used to receive the electrical signal of the device under test and send the electrical signal converted by the level conversion circuit to the device under test;
[0012] The level conversion circuit is connected to the Phoenix terminal and is used for performing level conversion on the electrical signal transmitted between the Phoenix terminal and the control module.
[0013] Optionally, the optical serial port module includes: an optical fiber interface and a photoelectric conversion circuit;
[0014] The optical fiber interface is used to receive the optical signal of the device under test and send the optical signal converted by the photoelectric conversion circuit to the device under test;
[0015] The photoelectric conversion circuit is connected to the optical fiber interface, and is used to convert the optical signal of the device under test into an electrical signal and send it to the control module, and to convert the electrical signal output by the control module into an optical signal.
[0016] Optionally, the control module includes: a first processing module and a second processing module;
[0017] The first processing module includes: a receiving adaptive decoding unit, a storage unit and an output unit.
[0018] The receiving adaptive decoding unit is used to analyze the electrical signals converted by the electrical serial port module and the optical serial port module;
[0019] The storage unit is connected to the receiving adaptive decoding unit and is used to store the electrical signal parsed by the receiving adaptive decoding unit;
[0020] The output unit is connected to the storage unit and is used to output the electrical signal parsed by the receiving adaptive decoding unit;
[0021] The second processing module is connected to the storage unit, and is used to configure the electrical signal parsed by the receiving adaptive decoding unit and determine an output mode.
[0022] Optionally, the multifunctional serial port communication device further includes:
[0023] The display module is connected to the control module and is used to display the electrical signal parsed by the receiving adaptive decoding unit.
[0024] Optionally, the electrical serial port module includes an RS232 transceiver and an RS485 transceiver;
[0025] The communication ports of the RS232 transceiver and the RS485 transceiver are both connected to the communication port of the control module, and the enable end ports of the RS232 transceiver and the RS485 transceiver are respectively connected to the control signal port of the control module.
[0026] According to another aspect of the present invention, a multifunctional serial port communication method is provided, which is executed by the multifunctional serial port communication device provided by any of the above embodiments, and the multifunctional serial port communication method includes:
[0027] Acquire a signal to be tested from the device to be tested;
[0028] Determining a code type corresponding to the signal to be tested according to the level information and pulse width of the signal to be tested;
[0029] Decoding the signal to be tested according to a code type corresponding to the signal to be tested;
[0030] The code types corresponding to the signal to be tested include: a first code type, a second code type and a third code type.
[0031] Optionally, decoding the signal to be tested according to a code type corresponding to the signal to be tested includes:
[0032] When the code type is the first code type, generating a time synchronization second signal according to the number of pulses of the signal to be tested;
[0033] When the code type is the second code type, the code element corresponding to the signal to be tested is determined according to the pulse width of the signal to be tested, and the time information is determined according to the code element corresponding to the signal to be tested.
[0034] Optionally, decoding the signal to be tested according to a code type corresponding to the signal to be tested further includes:
[0035] When the code type is the third code type, the receiving mode is determined according to the pulse width of the signal to be tested, and the signal to be tested is decoded according to different receiving modes; wherein the receiving mode includes a synchronous receiving mode and an asynchronous receiving mode;
[0036] When the receiving mode is a synchronous receiving mode, a sampling frequency is determined according to the pulse width of the signal to be measured, and a sampling clock is generated according to the sampling frequency;
[0037] The signal to be tested is decoded according to the sampling clock.
[0038] Optionally, decoding the signal to be tested according to different receiving modes includes:
[0039] When the receiving mode is a synchronous receiving mode, the sampling frequency is determined according to the pulse width of the signal to be measured;
[0040] Obtaining a message header, a start bit, a data bit, a check bit, and a stop bit of the signal to be tested;
[0041] The signal to be tested is decoded according to the start bit, the data bit, the check bit and the stop bit.
[0042] The technical solution of the embodiment of the present invention is that the multifunctional serial port communication device includes an electrical serial port module and an optical serial port module. The electrical serial port module can receive the electrical signal of the device to be tested, and the optical serial port module can receive the optical signal of the device to be tested. The control module can analyze the optical signal and the electrical signal of the device to be tested at the same time, and feed back the analyzed signal to the device to be tested through the corresponding electrical serial port module and the optical serial port module. The multifunctional serial port communication device provided by the embodiment of the present invention can simultaneously support the communication and analysis of electrical signals and optical signals, realize multiple communication modes, and does not require the operator to frequently change the communication device, which makes testing more convenient. In addition, the communication device has a high degree of integration and a relatively small size, which is convenient for the operator to carry and more convenient to use.
[0043] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present invention, nor are they intended to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0045] Figure 1 A schematic diagram of the structure of a multifunctional serial communication device provided by an embodiment of the present invention;
[0046] Figure 2 A schematic diagram of the structure of another multifunctional serial communication device provided by an embodiment of the present invention;
[0047] Figure 3 A schematic diagram of the structure of a control module provided by an embodiment of the present invention;
[0048] Figure 4 A schematic diagram of the structure of another multifunctional serial communication device provided by an embodiment of the present invention;
[0049] Figure 5 A partial structural diagram of another multifunctional serial port communication device provided by an embodiment of the present invention;
[0050] Figure 6A flowchart of a multifunctional serial port communication method provided by an embodiment of the present invention;
[0051] Figure 7 A flowchart of another multi-functional serial port communication method provided by an embodiment of the present invention;
[0052] Figure 8 A flowchart of another multi-functional serial port communication method provided by an embodiment of the present invention;
[0053] Fig. 9 A flowchart of another multi-functional serial port communication method provided by an embodiment of the present invention;
[0054] Fig.10 A flowchart of another multi-functional serial port communication method provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0055] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
[0056] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0057] Figure 1 A schematic diagram of the structure of a multifunctional serial communication device provided by an embodiment of the present invention. Figure 1The multifunctional serial port communication device 100 includes an electrical serial port module 10, an optical serial port module 20 and a control module 30. The electrical serial port module 10 is connected to the control module 30, and is used to receive the electrical signal of the device under test and convert it into an electrical signal matching the control module 30 and then send it to the control module 30, and convert the electrical signal output by the control module 30 and then output it to the device under test. The optical serial port module 20 is connected to the control module 30, and is used to receive the optical signal of the device under test and convert the optical signal into an electrical signal and then send it to the control module 30, and convert the electrical signal output by the control module into an optical signal and then output it to the device under test; the control module 30 is used to parse the electrical signal output by the electrical serial port module 10 and / or the electrical signal output by the optical serial port module 20, and output the corresponding electrical signal to at least one of the electrical serial port module 10 and the optical serial port module 20.
[0058] Specifically, when the protection test is performed on the device under test, since the output signal of the power equipment includes an optical signal and an electrical signal, the test device not only needs to receive the electrical signal of the device under test, but also needs to receive the optical signal of the device under test. The multifunctional serial port communication device provided by the present invention includes an electrical serial port module 10 and an optical serial port module. The electrical serial port module is mainly used to receive the electrical signal output by the device under test, and the optical serial port module is used to receive the optical signal output by the device under test. However, because the optical signal and the electrical signal emitted by the device under test do not match the control module 30, the control module 30 cannot directly decode the signal output by the device under test, and it is also necessary to convert the received electrical signal and optical signal. After receiving the electrical signal of the device under test, the electrical serial port module 10 also needs to convert the level of the received electrical signal into a level signal matching the control module 30 so that the control module 30 can parse it. The optical serial port module 20 receives an optical signal, while the control module 30 can only receive an electrical signal, because the optical serial port module 20 also needs to convert the received optical signal into an electrical signal so that the control module 30 can parse it. After the control module 30 parses the corresponding signal, it is also necessary to feed back the parsed signal to the device under test. If the control module 30 receives an electrical signal sent by the optical serial port module 10, after the control module 30 parses it, the parsed electrical signal needs to be sent to the electrical serial port module 10, and the electrical serial port module 10 adjusts the level information of the parsed electrical signal according to the needs of the device under test, and adjusts it to an electrical signal that can be received by the device under test. If the control module 30 parses the electrical signal sent by the optical serial port module 20, after the control module 30 parses it, it is necessary to send the parsed electrical signal to the optical serial port module 20, and the optical serial port module 20 needs to convert the parsed electrical signal into an optical signal, and then feed back the converted optical signal to the device under test. The multifunctional serial port device provided by the present invention can support the communication of optical serial ports and electrical serial ports, meet the communication requirements of the device under test, have a wide range of application scenarios, and is easy to use.
[0059] The multifunctional serial port communication device provided in the embodiment of the present invention includes an electrical serial port module and an optical serial port module. The electrical serial port module can receive the electrical signal of the device to be tested, and the optical serial port module can receive the optical signal of the device to be tested. The control module can analyze the optical signal and the electrical signal of the device to be tested at the same time, and feed back the analyzed signal to the device to be tested through the corresponding electrical serial port module and the optical serial port module. The multifunctional serial port communication device provided in the embodiment of the present invention can simultaneously support the communication and analysis of electrical signals and optical signals, realize multiple communication modes, and does not require the operator to frequently change the communication device, which makes testing more convenient. In addition, the communication device has a high degree of integration and a relatively small size, which is convenient for the operator to carry and more convenient to use.
[0060] Optional, Figure 2 A schematic diagram of the structure of another multifunctional serial communication device provided by an embodiment of the present invention. Figure 2 The electrical serial port module 10 includes a Phoenix terminal 11 and a level selection conversion circuit 12. The Phoenix terminal 11 is used to receive the electrical signal of the device under test and send the electrical signal converted by the level conversion circuit to the device under test. The level conversion circuit 12 is connected to the Phoenix terminal 11 and is used to convert the level of the electrical signal transmitted between the Phoenix terminal 11 and the control module 30.
[0061] Specifically, the electrical serial port module 10 includes a Phoenix terminal 11 and a level conversion circuit 12. The Phoenix terminal 11 is connected to the device under test, and is used to receive the electrical signal output by the device under test when the device under test outputs an electrical signal. The level conversion circuit 12 is connected to the Phoenix terminal 11 and the control module 30, and converts the level of the received electrical signal into an electrical signal that matches the control module 30. The control module 30 analyzes the electrical signal and sends the analyzed electrical signal to the level conversion module 12. The level conversion module 12 adjusts the level of the analyzed electrical signal according to the requirements of the device under test, adjusts it to an electrical signal that the device under test can receive, and then sends the adjusted electrical signal to the device under test through the Phoenix terminal 11.
[0062] Optionally, based on the above embodiment, continue to refer to Figure 2 The optical serial port module 20 includes an optical fiber interface 21 and an optoelectronic conversion circuit 22; the optical fiber interface 21 is used to receive an optical signal of the device under test and send the optical signal converted by the optoelectronic conversion circuit to the device under test; the optoelectronic conversion circuit 22 is connected to the optical fiber interface 21 and is used to convert the optical signal of the device under test into an electrical signal and send it to the control module 30, and convert the electrical signal output by the controlled module 30 into an optical signal.
[0063] Specifically, the optical serial port module 20 includes an optical fiber interface 21 and an optoelectronic conversion circuit 22. The optical fiber interface 21 is connected to the device under test. When the device under test outputs an optical signal, the optical fiber interface 21 is used to receive the optical signal of the device under test. The optoelectronic conversion module 22 is connected to the optical fiber interface 21 and the control module 30. After receiving the optical signal, the optical signal is converted into an electrical signal so that the control module 30 can analyze it. After the control module 30 analyzes it, it generates an electrical signal and sends the electrical signal to the optoelectronic conversion circuit 22. Since the device under test receives an optical signal, the optoelectronic conversion circuit 22 converts the received electrical signal into an optical signal and sends it to the optical fiber interface 21. The optical fiber interface 21 sends the optical signal to the device under test.
[0064] Optional, Figure 3 A schematic diagram of the structure of a control module provided by an embodiment of the present invention. Figure 3 The control module 30 includes a first processing module 31 and a second processing module 32; the first processing module 31 includes a receiving adaptive decoding unit 311, a storage unit 312 and an output unit 313, the receiving adaptive decoding unit 311 is used to parse the electrical signal converted by the electrical serial port module 10 and the optical serial port module 20, the storage unit 312 is connected to the receiving adaptive decoding unit, and is used to store the electrical signal parsed by the receiving adaptive decoding unit, the output unit 313 is connected to the storage unit, and is used to output the electrical signal parsed by the receiving adaptive decoding unit, and the second processing module 32 is connected to the storage unit, and is used to configure the electrical signal parsed by the receiving adaptive decoding unit and determine the output mode.
[0065] Specifically, the control module of the multifunctional serial port communication device 100 provided in the embodiment of the present invention may include a first processing module 31 and a second processing module 32, wherein the first processing module 31 is connected to the second processing module 32, and the first processing module 31 includes a receiving adaptive decoding unit 311, a storage unit 312, and an output unit 313. The receiving adaptive decoding unit 311 performs an analysis operation on the electrical signal after receiving the electrical signal sent by the electrical serial port module 10 and the optical serial port module 20, and the analyzed electrical signal is stored in the storage unit 312. The second processing module 32 extracts the electrical signal in the storage unit 32, configures the analyzed electrical signal, and extracts the data information carried by the analyzed electrical signal. In addition, the second processing module 32 also needs to determine how to output the analyzed electrical signal to the device under test, whether to select the electrical serial port module 10 to output to the device under test, or to select the optical serial port module 20 to output to the device under test. After determining the output mode, the output unit 313 sends the parsed electrical signal to the electrical serial port module 10 and the optical serial port module 20, which are then output to the device under test by the electrical serial port module 10 and the optical serial port module 20. The first processing module 31 may be a field programmable gate array, and the second processing module 32 may be a central processing unit.
[0066] Optional, Figure 4 A schematic diagram of the structure of another multifunctional serial communication device provided by an embodiment of the present invention. Figure 4 The multifunctional serial communication device 100 further includes a display module 40 connected to the control module 30 and configured to display the electrical signal analyzed by the receiving adaptive decoding unit 311 .
[0067] Specifically, the multifunctional serial port communication device 100 further includes a display device 40, which is connected to the control module 30. After the control module 30 analyzes the electrical signals sent by the electrical serial port module 10 and the optical serial port module 20, the display module 40 is used to display the analyzed signals, so that the operator can view the analysis results and better control the device under test.
[0068] Optional, Figure 5 A partial structural diagram of another multifunctional serial communication device provided by an embodiment of the present invention. Figure 5 The electrical serial port module 10 includes an RS232 transceiver 13 and an RS485 transceiver 14, the communication ports of the RS232 transceiver 13 and the RS485 transceiver 14 are connected to the communication port of the control module 30, and the enable ports of the RS232 transceiver 13 and the RS485 transceiver 14 are respectively connected to the control signal port of the control module.
[0069] Specifically, the electrical serial port module 10 may also include an RS232 transceiver 13 and an RS485 transceiver 14. The communication port C1 of the control module 30 is respectively connected to the input communication port A1 of the RS232 transceiver 13 and the input communication port A3 of the RS485 transceiver, and the communication port C2 of the control module 30 is respectively connected to the output communication port A2 of the RS232 transceiver 13 and the input communication port A4 of the RS485 transceiver. The control signal port D1 of the control module 30 is connected to the enable port B1 of the RS232 transceiver 13, and the control signal port D2 of the control module 30 is connected to the enable port B2 of the RS485 transceiver 14. After the electrical serial port module 10 receives the electrical signal of the device under test, it first determines which transceiver the electrical signal of the device under test transmits the signal through. If RS232 transceiver 13 is selected for communication, after the electrical serial port module 10 receives the electrical signal of the device under test, the electrical signal is transmitted to the control module 30 through RS232 transceiver 13, and the control module 30 analyzes the electrical signal, and the analyzed electrical signal is fed back to the device under test through RS232 transceiver 13.
[0070] The multifunctional serial port communication device provided by the embodiment of the present invention can not only analyze optical signals, but also analyze electrical signals. At the same time, the electrical serial port module can transmit electrical signals with RS232 transceiver and RS485 transceiver, which can meet the transmission process of electrical signals under different conditions, realize the protection test of different signals to be tested, and has a wider range of application scenarios.
[0071] The embodiment of the present invention also provides a multifunctional serial port communication method. Figure 6 This is a flow chart of a multifunctional serial port communication method provided by an embodiment of the present invention. The method can be executed by the multifunctional serial port communication device provided by any of the above embodiments.
[0072] like Figure 6 As shown, the multifunctional serial port communication method provided by the embodiment of the present invention includes:
[0073] S110: Acquire a signal to be tested from the device to be tested.
[0074] Specifically, before communicating with the device under test, it is necessary to obtain the signal under test of the device under test, wherein the signal under test may include an electrical signal and an optical signal. Exemplarily, if the signal under test is an electrical signal, the electrical signal of the device under test may be obtained through the electrical serial port module 10, and if the signal under test is an optical signal, the optical signal of the device under test may be obtained through the optical serial port module 20.
[0075] S120 , determining a code type corresponding to the signal to be tested according to the level signal and the pulse width of the signal to be tested.
[0076] Specifically, after obtaining the signal to be tested of the device to be tested, the signal to be tested is sent to the control module 30, and the control module 30 detects the level information and pulse width of the signal to be tested, and determines the code type corresponding to the signal to be tested according to different level information and pulse widths. Among them, the code type corresponding to the signal to be tested includes: a first code type, a second code type and a third code type. Among them, the first code type can be a PPS code type, the second code type can be an IRIG-B code type, and the third code type can be an FT3 code type. Exemplarily, if it is detected that the signal to be tested is once per second and the pulse width is in the range of 10ms-200ms, the signal to be tested is a PPS code type; if the signal to be tested is a pulse signal with one frame per second and contains 100 10ms code elements, it is determined that the signal to be tested is an IRIG-B code type; if the frequency of the signal to be tested is higher, it is determined that the signal to be tested is an FT3 code type.
[0077] S130 , decoding the signal to be tested according to a code type corresponding to the signal to be tested.
[0078] Specifically, after the control module 30 determines the code type of the signal to be tested according to the level information and the pulse width, the control module 30 can perform decoding operations on the signal to be tested according to different code types. Different code types have different meanings and require different decoding methods.
[0079] Optional, Figure 7 A flowchart of another multi-function serial port communication method provided by an embodiment of the present invention. Figure 7 , a multifunctional serial port communication method provided by an embodiment of the present invention includes:
[0080] S210: Acquire a signal to be tested from the device to be tested.
[0081] S220 , determining a code type corresponding to the signal to be tested according to the level signal and the pulse width of the signal to be tested.
[0082] S230: When the code type is the first code type, generate a time synchronization second signal according to the number of pulses of the signal to be tested.
[0083] Specifically, when the control module 30 determines that the signal to be tested is the first code type, the control module 30 decodes the signal to be tested according to the decoding method of the first code type. The control module 30 determines the pulse number of the signal to be tested and determines whether the signal to be tested contains a time synchronization signal. After the control module 30 determines that the signal to be tested is valid, the time synchronization second signal of the signal to be tested is read and the time synchronization second signal is output to the device to be tested. That is, the control module 30 detects the pulse containing the time synchronization signal in the signal to be tested, extracts it to generate the time synchronization second signal, and then outputs the time synchronization second signal to the device to be tested.
[0084] S240: When the code type is the second code type, determine a code element corresponding to the signal to be tested according to the pulse width of the signal to be tested, and determine time information according to the code element corresponding to the signal to be tested.
[0085] Specifically, when the control module 30 determines that the signal to be tested is the second code type, the control module 30 decodes the signal to be tested according to the decoding method of the second code type. The control module 30 first needs to determine the code element of the signal to be tested according to the pulse width of the signal to be tested. The second code type includes 100 code elements of 10ms, and different code elements correspond to different pulse widths. Exemplarily, the "0" code element is to first maintain a high level for 2ms, and then a low level for 8ms; the "1" code element is to first maintain a high level for 5ms, and then a low level for 5ms; the "P" code element is to first maintain a high level for 8ms, and then a low level for 2ms. Finally, the control module 30 parses the signal to be tested according to the code element information read, and can parse out the time information of the signal to be tested. Among them, the time information may include time information such as seconds, minutes, hours, days, and years.
[0086] Optional, Figure 8A flowchart of another multi-function serial port communication method provided by an embodiment of the present invention. Figure 8 , a multifunctional serial port communication method provided by an embodiment of the present invention includes:
[0087] S310: Acquire a signal to be tested from the device to be tested.
[0088] S320 , determining a code type corresponding to the signal to be tested according to the level signal and the pulse width of the signal to be tested.
[0089] S330: When the code type is the third code type, determine a receiving mode according to the pulse width of the signal to be tested, and decode the signal to be tested according to different receiving modes.
[0090] Specifically, when the control module 30 determines that the signal to be tested is the third code type, the control module 30 also needs to determine the receiving mode of the signal to be tested according to the level information and pulse width of the signal to be tested. Different receiving modes have different sampling frequencies and sampling clocks, and different receiving modes have different decoding methods for the signal to be tested of the device to be tested. Therefore, when the control module 30 determines that the signal to be tested is the third code type, it is also necessary to determine the receiving mode of the signal to be tested according to the level signal and pulse width of the signal to be tested, so as to perform different decoding operations. Among them, the receiving mode can include a synchronous receiving mode and an asynchronous receiving mode.
[0091] S340: When the receiving mode is a synchronous receiving mode, a sampling frequency is determined according to a pulse width of the signal to be measured, and a sampling clock is generated according to the sampling frequency.
[0092] Specifically, when the control module 30 determines that the receiving mode is a synchronous receiving mode according to the level information and pulse width of the signal to be tested, the control module 30 first determines the sampling frequency of the signal to be tested according to the pulse width of the signal to be tested, and then determines the corresponding sampling clock according to the sampling frequency. In the synchronous receiving mode, the signal to be tested is continuous, so it is only necessary to obtain the sampling frequency and sampling clock of the signal to be tested, and then the signal to be tested can be sampled and the sampled signal to be tested can be decoded.
[0093] S350 , decoding the signal to be tested according to the sampling clock.
[0094] Specifically, after the control module 30 obtains the corresponding sampling frequency and sampling clock according to the pulse width of the signal to be tested, the control module 30 samples the signal to be tested at the rising edge of the sampling clock, and then parses the sampled signal to be tested to parse out the length of the message. In the synchronous receiving mode, the signal to be tested corresponding to the rising edge is more stable, and the effective information carried in the signal to be tested is generally located in the pulse corresponding to the rising edge, and the parsed signal to be tested is also more accurate.
[0095] Optional, Fig. 9 A flowchart of another multi-function serial port communication method provided by an embodiment of the present invention. Fig. 9 , a multifunctional serial port communication method provided by an embodiment of the present invention includes:
[0096] S410: Acquire a signal to be tested from the device to be tested.
[0097] S420: Determine a code type corresponding to the signal to be tested according to the level signal and the pulse width of the signal to be tested.
[0098] S430: When the code type is the third code type, determine a receiving mode according to the pulse width of the signal to be measured.
[0099] S440: When the receiving mode is a synchronous receiving mode, the sampling frequency is determined according to the pulse width of the signal to be measured.
[0100] Specifically, in different receiving modes, the pulse width of the signal to be tested is different, and the corresponding frequency is also different. When the control module 30 determines that the receiving mode is a synchronous receiving mode according to the level information and pulse width of the signal to be tested, the control module 30 also needs to determine the sampling frequency of the signal to be tested according to the pulse width of the signal to be tested. After determining the sampling frequency of the signal to be tested, the control module 30 determines whether there will be regular repeated data in the data to be tested according to the sampling frequency. If there is, it means that there is message information in the signal to be tested, and the message information can be parsed by the control module 30.
[0101] S450, obtaining a message header, a start bit, a data bit, a check bit, and a stop bit of the signal to be tested.
[0102] Specifically, after the control module 30 obtains the sampling frequency of the signal to be tested and determines the message data in the signal to be tested, it is also necessary to obtain the message header, start bit, data bit, check bit and stop bit of the signal to be tested through the control module 30. After obtaining the message information, the control module 30 can detect the message header according to the message polarity, wherein the message polarity can be a specific field in the message header. After the control module 30 obtains the message header of the signal to be tested, the start bit, data bit, check bit and stop bit of the signal to be tested can be obtained according to the message header.
[0103] S460, decoding the signal to be tested according to the start bit, data bit, check bit and stop bit.
[0104] Specifically, after the control module 30 obtains the start bit, data bit, check bit and stop bit of the signal to be tested, the control module 30 can parse the data to be tested according to the start bit, data bit, check bit and stop bit of the signal to be tested. Among them, the start bit indicates the beginning of the valid character in the data to be tested, and the logic level is usually "0". The data bit indicates the valid data actually transmitted in the data to be tested. According to the communication protocol, the data can be 5 bits, 6 bits, 8 bits or more bits. The check bit is used to verify whether the data is wrong. The check bit can be odd check, even check, no check and mark check, etc. The stop bit is the stop of the valid data in the signal to be tested, and the logic level is usually "1". According to the communication protocol, the stop bit width can be 0.5 bits, 1 bits, 2 bits, etc. The control module 30 mainly parses the data bit, stops parsing at the stop bit, and judges whether the parsed data is accurate through the check bit.
[0105] Optional, Fig.10 A flowchart of another multi-function serial port communication method provided by an embodiment of the present invention. Fig.10 , a multifunctional serial port communication method provided by an embodiment of the present invention includes:
[0106] Specifically, after the control module 30 receives the signal to be tested, the code type of the signal to be tested is determined according to the level information and pulse width of the signal to be tested. When the control module 30 determines that the signal to be tested is a PPS code type, the time-synchronized second pulse in the signal to be tested is extracted and the time-synchronized second pulse is output to the device to be tested. When the control module determines that the signal to be tested is an IRIG-B code type, the control module 30 determines the code element of the signal to be tested according to the pulse width of the signal to be tested. The code element of the signal to be tested may include a "0" code element, a "1" code element and a "P" code element. Then the control module 30 stores an IRIG-B code pulse sequence of one frame per second, and then parses the pulse sequence to parse out time information such as seconds, minutes, hours, days, and years. When the control module determines that the code type of the signal to be tested is an FT3 code type, it is also necessary to determine whether the receiving mode of the signal to be tested is a synchronous receiving mode or an asynchronous receiving mode according to the pulse level information and pulse width of the signal to be tested. If it is a synchronous receiving mode, the control module 30 determines the sampling frequency in the synchronous mode according to the pulse width of the signal to be tested, generates the corresponding Manchester encoding clock according to the sampling frequency, samples the FT3 code at the rising edge of the Manchester encoding clock, and then the control module 30 performs analysis to determine the length of the message and whether the message is abnormal; if it is an asynchronous receiving mode, the control module 30 determines the sampling frequency in the asynchronous mode according to the pulse width of the signal to be tested, and then obtains the message header according to the sampling frequency, and determines whether it is the required message header by self-correcting the positive and negative polarity of the message. Then, the control module 30 reads the start bit, data bit, check bit and end bit of the signal to be tested, mainly to parse the signal of the data bit, and determine whether the check bit is accurate and the bit width of the stop bit, end the decoding process at the stop bit, and finally feed back the decoding result to the device to be tested.
[0107] The multifunctional serial port communication method provided by the embodiment of the present invention first obtains the signal to be tested, determines the code type corresponding to the signal to be tested according to the level information and pulse width of the signal to be tested, and divides the code type of the signal to be tested into three code types, and different code types correspond to different decoding methods. The analysis of signals to be tested in different formats is realized, the analysis process is more accurate, the application scenarios are more, and the decoding speed is fast. The message can be output while receiving the message, realizing the serial listening function of the serial port.
[0108] Note that the above are only preferred embodiments of the present invention and the technical principles used. Those skilled in the art will understand that the present invention is not limited to the specific embodiments described herein, and that various obvious changes, readjustments and substitutions can be made by those skilled in the art without departing from the scope of protection of the present invention. Therefore, although the present invention has been described in more detail through the above embodiments, the present invention is not limited to the above embodiments, and may include more other equivalent embodiments without departing from the concept of the present invention, and the scope of the present invention is determined by the scope of the appended claims.
Claims
1. A multifunctional serial communication device, characterized in that: include: Electrical serial port module, optical serial port module and control module; The electrical serial port module is connected to the control module, and is used to receive the electrical signal of the device under test and convert it into an electrical signal matching the control module and then send it to the control module, and convert the electrical signal output by the control module and then output it to the device under test; The optical serial port module is connected to the control module, and is used to receive the optical signal of the device under test and convert the optical signal into an electrical signal and then send it to the control module, and convert the electrical signal output by the control module into an optical signal and then output it to the device under test; The control module is used to analyze the electrical signal output by the electrical serial port module and / or the electrical signal output by the optical serial port module, and output a corresponding electrical signal to at least one of the electrical serial port module and the optical serial port module.
2. The multifunctional serial communication device according to claim 1, characterized in that: The electrical serial port module comprises: a Phoenix terminal and a level selection conversion circuit; The Phoenix terminal is used to receive the electrical signal of the device under test and send the electrical signal converted by the level conversion circuit to the device under test; The level conversion circuit is connected to the Phoenix terminal and is used for performing level conversion on the electrical signal transmitted between the Phoenix terminal and the control module.
3. The multifunctional serial communication device according to claim 1, characterized in that: The optical serial port module includes: an optical fiber interface and a photoelectric conversion circuit; The optical fiber interface is used to receive the optical signal of the device under test and send the optical signal converted by the photoelectric conversion circuit to the device under test; The photoelectric conversion circuit is connected to the optical fiber interface, and is used to convert the optical signal of the device under test into an electrical signal and send it to the control module, and to convert the electrical signal output by the control module into an optical signal.
4. The multifunctional serial communication device according to claim 1, characterized in that: The control module includes: a first processing module and a second processing module; The first processing module includes: a receiving adaptive decoding unit, a storage unit and an output unit; The receiving adaptive decoding unit is used to analyze the electrical signals converted by the electrical serial port module and the optical serial port module; The storage unit is connected to the receiving adaptive decoding unit and is used to store the electrical signal parsed by the receiving adaptive decoding unit; The output unit is connected to the storage unit and is used to output the electrical signal parsed by the receiving adaptive decoding unit; The second processing module is connected to the storage unit, and is used to configure the electrical signal parsed by the receiving adaptive decoding unit and determine an output mode.
5. The multifunctional serial communication device according to claim 4, characterized in that: Also includes: The display module is connected to the control module and is used to display the electrical signal parsed by the receiving adaptive decoding unit.
6. The multifunctional serial communication device according to claim 1, characterized in that: The electrical serial port module includes an RS232 transceiver and an RS485 transceiver; The communication ports of the RS232 transceiver and the RS485 transceiver are both connected to the communication port of the control module, and the enable end ports of the RS232 transceiver and the RS485 transceiver are respectively connected to the control signal port of the control module.
7. A multifunctional serial port communication method, characterized in that: Executed by the multifunctional serial port communication device according to any one of claims 1 to 6, the multifunctional serial port communication method comprises: Acquire a signal to be tested from the device to be tested; Determining a code type corresponding to the signal to be tested according to the level information and pulse width of the signal to be tested; Decoding the signal to be tested according to a code type corresponding to the signal to be tested; The code types corresponding to the signal to be tested include: a first code type, a second code type and a third code type.
8. The multifunctional serial communication method according to claim 7, characterized in that: Decoding the signal to be tested according to a code type corresponding to the signal to be tested includes: When the code type is the first code type, generating a time synchronization second signal according to the number of pulses of the signal to be tested; When the code type is the second code type, the code element corresponding to the signal to be tested is determined according to the pulse width of the signal to be tested, and the time information is determined according to the code element corresponding to the signal to be tested.
9. The multifunctional serial communication method according to claim 7, characterized in that: Decoding the signal to be tested according to the code type corresponding to the signal to be tested, further comprising: When the code type is the third code type, the receiving mode is determined according to the pulse width of the signal to be tested, and the signal to be tested is decoded according to different receiving modes; wherein the receiving mode includes a synchronous receiving mode and an asynchronous receiving mode; When the receiving mode is a synchronous receiving mode, a sampling frequency is determined according to the pulse width of the signal to be measured, and a sampling clock is generated according to the sampling frequency; The signal to be tested is decoded according to the sampling clock.
10. The multifunctional serial communication method according to claim 9, characterized in that: Decoding the signal to be tested according to different receiving modes includes: When the receiving mode is a synchronous receiving mode, the sampling frequency is determined according to the pulse width of the signal to be measured; Obtaining a message header, a start bit, a data bit, a check bit, and a stop bit of the signal to be tested; The signal to be tested is decoded according to the start bit, the data bit, the check bit and the stop bit.