Data read-write apparatus, data read-write method, and log read-write system
By designing a data reading and writing device including storage unit, control unit, interface unit, and communication switching unit, the problem of data reading and writing of electronic equipment in a special environment is solved, and convenient data exchange is achieved, which is suitable for more scenarios.
Patent Information
- Application Number
- CN202411475071.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-22
- Publication Date
- 2025-01-24
AI Technical Summary
The prior art is difficult to realize the convenient reading and writing of electronic devices when they are installed in a special environment, especially when the device is inconvenient to disassemble or connect.
A data reading and writing device is designed, including the storage unit, control unit, interface unit, and communication switching unit. This device is selected by different communication branches to realize the data writing of the first device and the data reading of the second device, avoiding the demand for device disassembly and direct connection.
When an electronic device is installed in a special environment, data can be easily read from the device and transferred to other devices, providing a data reading and writing solution suitable for more scenarios.
Smart Images

Figure CN119357098A_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the technical field of data reading and writing devices, and in particular, relates to a data reading and writing device, a data reading and writing method, and a log reading and writing system. Background Art
[0002] At present, most electronic devices have the function of storing data. For example, a certain electronic device has a built-in storage device that records the log data it generates. Specifically, it can be generated by recording the fault information of the electronic device during operation, etc., and the corresponding log data is stored in the memory of the first device. Other electronic devices, such as a host computer, can be used to read the log data from the built-in storage device of the electronic device, providing a data basis for analyzing the working condition or fault cause of the electronic device.
[0003] However, for some electronic devices, when they are installed in special environments, it is not only inconvenient to disassemble the device, but also inconvenient to connect to a second device. For example, vacuum units and vacuum pumps are installed in the operating room. Therefore, it can be seen that there is an urgent need for a data reading and writing solution that can be applied to electronic devices in more scenarios. Summary of the invention
[0004] The purpose of the present application is to provide a data reading and writing device, a data reading and writing method, and a log reading and writing system, and to provide a data reading and writing device that can be applied to electronic devices in more scenarios.
[0005] A first aspect of an embodiment of the present application provides a data reading and writing device, comprising:
[0006] A storage unit for storing data;
[0007] a control unit connected to the storage unit;
[0008] An interface unit, used to connect an external device; wherein the external device includes a first device and a second device; a communication switching unit, connected between the interface unit and the control unit, the communication switching unit being used to, when the interface unit is connected to the first device, select a first communication branch between the interface unit and the control unit, and when the interface unit is connected to the second device, select a second communication branch between the interface unit and the control unit;
[0009] The control unit is also used to write the first data of the first device into the storage unit when the first communication branch is turned on, and to send the second data read from the storage unit to the second device when the second communication branch is turned on.
[0010] A data reading and writing device provided in an embodiment of the present application includes a storage unit, a control unit, an interface unit, and a communication switching unit. When the interface unit is connected to the first device, the first data of the first device can be written into the storage unit by selecting the first communication branch between the interface unit and the control unit. When the interface unit is connected to the second device, the second data read from the storage unit can be sent to the second device by the control unit by selecting the second communication branch between the interface unit and the control unit. In this way, the data of the first device can be read from the first device and stored in the storage unit, such as log data, control parameters, etc., and when the second device is connected through the interface unit, the data stored in the storage unit is sent to the second device. It is realized that even if the first device is set in a special environment, it is not necessary to disassemble the first device, or connect the second device to the first device, and then read the data from the first device, which provides a new implementation method for data reading and writing between the first device and the second device.
[0011] In addition, when the data reading and writing device is connected to the first device, the first device can directly write the first data into the storage unit of the data reading and writing device through the first communication branch. When the data reading and writing device is connected to the second device, the data reading and writing device can automatically switch the path so that the second device can read the second data from the storage unit through the second communication branch.
[0012] A second aspect of an embodiment of the present application provides a data reading and writing method, which is applied to the data reading and writing device provided in the first aspect above, and the method includes:
[0013] When the first communication branch is turned on, the first data of the first device is written into the storage unit, and the first communication branch is a path selected by the communication switching unit when the interface unit is connected to the first device;
[0014] When the second communication branch is turned on, the second data read from the storage unit is sent to the second device. The second communication branch is a path selected by the communication switching unit when the interface unit is connected to the second device.
[0015] A data reading and writing method provided by an embodiment of the present application writes the first data of the first device into a storage unit when the first communication branch is turned on, and sends the second data read from the storage unit to the second device when the second communication branch is turned on. In this way, the data of the first device stored in the storage unit, such as log data, control parameters, etc., can be read from the first device first, and when connected to the second device through the interface unit, the data stored in the storage unit is sent to the second device. This achieves that even if the first device is set in a special environment, there is no need to disassemble the first device, or connect the second device to the first device, in order to read data from the first device, providing a new way to implement data reading and writing between the first device and the second device.
[0016] A third aspect of an embodiment of the present application provides a log reading and writing system, including an external device, and the log reading and writing system also includes the data reading and writing device provided by the first aspect above; wherein the external device includes a first device and a second device, the log data generated by the first device is read and recorded by the data reading and writing device, and the second device reads the log data from the data reading and writing device.
[0017] It can be understood that the beneficial effects of the third aspect mentioned above can be found in the relevant description of the first aspect mentioned above, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] Figure 1 A schematic diagram of the structure of a data reading and writing device provided in an embodiment of the present application;
[0019] Figure 2 A specific structural diagram of a data reading and writing device provided in an embodiment of the present application Figure 1 ;
[0020] Figure 3 A specific structural diagram of a data reading and writing device provided in an embodiment of the present application Figure 2 ;
[0021] Figure 4 A schematic diagram of the specific structure of a communication switching unit in a data reading and writing device provided in an embodiment of the present application;
[0022] Figure 5 A specific circuit diagram of a communication switching unit in a data reading and writing device provided in an embodiment of the present application;
[0023] Figure 6 A flowchart of a data reading and writing method provided in an embodiment of the present application;
[0024] Figure 7 A schematic diagram of a log reading and writing system provided in this embodiment. DETAILED DESCRIPTION
[0025] In order to make the technical problems, technical solutions and beneficial effects to be solved by the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0026] It should be noted that when an element is referred to as being "fixed to" or "disposed on" another element, it can be directly on the other element or indirectly on the other element. When an element is referred to as being "connected to" another element, it can be directly connected to the other element or indirectly connected to the other element.
[0027] It should be understood that the orientation or position relationship indicated by terms such as "length", "width", "up", "down", "front", "back", "left", "right", "vertical", "horizontal", "top", "bottom", "inside" and "outside" are based on the orientation or position relationship shown in the drawings, and are only for the convenience of describing the present application and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore should not be understood as a limitation on the present application.
[0028] In addition, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the features. In the description of this application, the meaning of "plurality" is two or more, unless otherwise clearly and specifically defined.
[0029] See also Figure 1 , Figure 1 The following is a schematic diagram of the structure of a data reading and writing device provided by an embodiment of the present application. For ease of explanation, only the parts related to the present embodiment are shown, which are described in detail as follows:
[0030] exist Figure 1 In the present invention, a data reading and writing device 100 includes: a storage unit 10, a control unit 20, an interface unit 30 and a communication switching unit 40. Specifically:
[0031] The storage unit 10 is used to store data. The control unit 20 is connected to the storage unit 10. The interface unit 30 is used to connect an external device; wherein the external device includes a first device and a second device. The communication switching unit 40 is connected between the interface unit 30 and the control unit 20. The communication switching unit 40 is used to enable the first communication branch between the interface unit 30 and the control unit 20 when the interface unit 30 is connected to the first device, and to enable the second communication branch between the interface unit 30 and the control unit 20 when the interface unit 30 is connected to the second device. The control unit 20 is also used to write the first data of the first device into the storage unit 10 when the first communication branch is turned on, and to send the second data read from the storage unit 10 to the second device when the second communication branch is turned on.
[0032] In the present embodiment, the interface unit 30 refers to a physical interface for connecting an external device provided on the data reading and writing device 100. An external device generally refers to a device that can exchange data with the data reading and writing device 100 through the interface unit 30. For example, a first device for writing data into the data reading and writing device 100, or a second device for reading data from the data reading and writing device 100. Here, the interface unit 30 can only be connected to one external device at a time, for example, when the interface unit 30 is connected to the first device, it is not connected to the second device. For another example, when the interface unit 30 is connected to the second device, it is not connected to the first device. Based on this, for the storage unit 10 in the data reading and writing device 100, at a certain time, when the external device connected to the interface unit 30 does not change, the reading and writing state of the data by the storage unit 10 does not change.
[0033] In all embodiments of the present application, the first device generally refers to an electronic device that can generate log data during its operation, and / or can store data such as its control parameters. For example, a vacuum unit, a vacuum pump, etc. installed in an operating room. Correspondingly, the first data of the first device can specifically be the log data generated in the first device and / or the control parameters of the first device, etc., which are not limited here. The second device generally refers to an electronic device that can be connected to the first device, and / or connected to the data reading and writing device 100, and then read the data of the first device and / or the data reading and writing device 100, such as a host computer, etc.
[0034] It should be noted that when the communication switching unit 40 selects the first communication branch between the interface unit 30 and the control unit 20, the first device connected to the interface unit 30 can communicate with the control unit 20 through the first communication branch. When the communication switching unit 40 selects the second communication branch between the interface unit 30 and the control unit 20, the second device connected to the interface unit 30 can communicate with the control unit 20 through the second communication branch. Here, the first communication branch and the second communication branch are physically isolated from each other. In a specific implementation, the first communication branch and the second communication branch are physically isolated from each other, and can be implemented based on different communication protocols. For example, the first communication branch can also be a communication branch that complies with the I2C bus protocol, and correspondingly, the second communication branch can be a communication branch that complies with the RS485 bus protocol.
[0035] As an embodiment, the first communication branch may be a CAN communication branch that complies with the CAN bus protocol, and correspondingly, the second communication branch may be a USB communication branch that complies with the USB bus protocol. In practical applications, the data reading and writing device 100 may be used to connect to the first device first, and the first communication branch between the interface unit 30 and the control unit 20 may be selected through the communication switching unit 40 for data transmission, that is, the first device may transmit data through the interface unit 30 and the CAN communication branch and the control unit 20, so that the control unit 20 may write the first data sent by the first device through the CAN communication branch into the storage unit 10. Subsequently, the data reading and writing device 100 may be used to connect to the second device, and the second communication branch between the interface unit 30 and the control unit 20 may be selected through the communication switching unit 40 for data transmission, that is, the second device may transmit data through the interface unit 30 and the USB communication branch and the control unit 20, so that the control unit 20 may read the second data from the storage unit 10, and send the second data to the second device through the USB communication branch.
[0036] Exemplarily, in a specific implementation, the storage unit 10 may be a memory fixedly arranged in a data reading and writing device, or a pluggable memory card, etc. The interface unit 30 may be at least one of a USB Type-A interface, a USB Type-C interface, a Micro-USB interface, and a PD interface.
[0037] The above scheme provides a data reading and writing device 100, which can write the first data of the first device into the storage unit 10 by selecting the first communication branch between the interface unit 30 and the control unit 20 when the interface unit 30 is connected to the first device. When the interface unit 30 is connected to the second device, the second data read from the storage unit 10 is sent to the second device by the control unit 20 by selecting the second communication branch between the interface unit 30 and the control unit 20. In this way, the data of the first device can be read from the first device and stored in the storage unit 10, such as log data and / or control parameters, etc., and when the second device is connected through the interface unit 30, the data stored in the storage unit 10 is sent to the second device. Even if the first device is set in a special environment, it is not necessary to disassemble the first device or connect the second device to the first device, and data can be read from the first device, which provides a new way to realize data reading and writing between the first device and the second device.
[0038] In addition, when the data reading and writing device 100 is connected to a first device, the first device can directly write the first data into the storage unit 10 of the data reading and writing device 100 through the first communication branch. When the data reading and writing device 100 is connected to a second device, the data reading and writing device 100 can automatically switch the path so that the second device can read the second data from the storage unit 10 through the second communication branch.
[0039] As an embodiment, the control unit 20 is further used to send a data write request to the first device through the first communication branch when the first communication branch is turned on, and to receive a data read request sent by the second device through the second communication branch when the second communication branch is turned on.
[0040] In this embodiment, the first device is used to return the first data to the control unit through the first communication branch according to the data write request. The second device is used to send a data read request to the control unit 20 through the second communication branch, and receive the second data returned by the control unit 20 through the second communication branch.
[0041] In a specific implementation, a presence detection circuit and a line switching switch can be configured in the communication switching unit 40, and the presence detection circuit can be used to detect the connection of the interface unit 30 to an external device. For example, the interface unit 30 controls the line switching switch switching unit to turn on the first communication branch or the second communication branch according to the presence detection result. Correspondingly, a program execution script when different communication branches are turned on can be configured in the control unit 20. By executing the script, when the first communication branch is turned on, the first data of the first device can be written into the storage unit 10, and when the second communication branch is turned on, the second data read from the storage unit 10 can be sent to the second device.
[0042] As an embodiment, the control unit 20 is further used to instruct the storage unit 10 to enter a data write mode and write the first data into the storage unit 10 when the first communication branch is turned on.
[0043] In this embodiment, when the first communication branch is connected, it means that the interface unit 30 is connected to the first device, and a data write request can be sent to the first device to read the data stored in the first device, such as the log data and / or control parameters of the first device.
[0044] Here, the control unit 20 instructs the storage unit 10 to enter a data write mode, which may be specifically to reset and initialize the storage unit 10, and to provide a write signal to the storage unit 10, so that when the storage unit 10 receives the first data obtained by the control unit 20 through the first communication branch, it can write the first data into the storage space for storage according to the write signal.
[0045] As an embodiment, the control unit 20 is further used to instruct the storage unit 10 to enter a data read mode when the second communication branch is turned on, and send the second data read from the storage unit 10 to the second device.
[0046] In this embodiment, when the second communication branch is connected, it means that the interface unit 30 is connected to the second device, and at this time, a data read request sent by the second device can be received, and then the data stored in the storage unit 10 can be read, such as the log data and / or control parameters of the first device.
[0047] Here, the control unit 20 instructs the storage unit 10 to enter the data read mode, specifically, it can send a command to the storage unit 10, so that the storage unit 10 can respond according to the command, so that the control unit 20 can read the second data stored in the storage unit 10. Then, it is uploaded to the second device through the second communication branch and the interface unit 30.
[0048] It can be understood that since the storage unit 10 is a storage module in the data reading and writing device 100, in a specific implementation, a data reading and writing mechanism adapted thereto can be configured in the control unit 20, so that the control unit 20 can perform data reading and writing operations on the storage unit 10 when different communication branches are turned on.
[0049] Figure 2 The specific structure of a data reading and writing device provided in an embodiment of the present application is shown in FIG. Figure 1 As an example, in Figure 2 In the embodiment, the communication switching unit 40 includes: a comparison unit 41 and a switching unit 42. Specifically:
[0050] The comparison unit 41 is connected to the power supply terminal 31 of the interface unit 30. The comparison unit 41 is used to output a first electrical signal when the interface unit 30 is connected to a first device according to the voltage of the power supply terminal 31, and output a second electrical signal when the interface unit 30 is connected to a second device according to the voltage of the power supply terminal 31. The voltage of the first electrical signal is not equal to the voltage of the second electrical signal. The switching unit 42 is connected to the comparison unit 41, and is used to select the first communication branch according to the first electrical signal, and select the second communication branch according to the second electrical signal.
[0051] In this embodiment, since the comparison unit 41 is connected to the power supply end of the interface unit 30, the voltage of the power supply end 31 can be sampled to obtain a sampled voltage. By comparing the sampled voltage with the reference voltage value, it can be determined according to the comparison result whether the interface unit 30 is connected to the first device or the second device, and then the first electrical signal or the second electrical signal is output.
[0052] In a specific implementation, the comparison unit 41 can be implemented by a comparison circuit including a comparator. Using the comparison circuit, the sampled voltage is compared with the reference voltage value, and the comparison result is transmitted to the switching unit 42 in the form of an electrical signal (i.e., a first electrical signal and a second electrical signal). Here, the first electrical signal and the second electrical signal can be level signals. For example, the first electrical signal is a high-level signal, and correspondingly, the second electrical signal is a low-level signal. For another example, the first electrical signal is a low-level signal, and correspondingly, the second electrical signal is a high-level signal. Correspondingly, the switching unit 42 can select different communication branches according to different level signals.
[0053] Figure 3 The specific structure of a data reading and writing device provided in an embodiment of the present application is shown in FIG. Figure 2 As an example, in Figure 3 In the embodiment, the comparison unit 41 at least comprises: a comparator U1 . A positive input terminal +IN of the comparator U1 is used to input a reference voltage Vref, a negative input terminal −IN of the comparator U1 is used to connect to the power supply terminal 31 , and an output terminal OUT of the comparator U1 is used to connect to the switching unit 42 .
[0054] In this embodiment, when the interface unit 30 is connected to an external device, the external device can power the data reading and writing apparatus 100 through the interface unit 30. At this time, since the negative input terminal -IN of the comparator U1 is connected to the power supply terminal 31, the power provided by the external device can be sampled.
[0055] Exemplarily, when the external device is the first device, it is assumed that the first device can provide 24V DC power to the data reading and writing device 100 through the interface unit 30. At this time, the sampling voltage V1 of the negative input terminal -IN of the comparator U1 to the power supply terminal 31 is equal to or greater than the reference voltage Vref, and the output of the comparator U1 is high level. When receiving the high level, the switching unit 42 selects the first communication branch. Based on this, the first device can exchange data with the control unit 20 through the interface unit 30, the switching unit 42 and the first communication branch. Because the control unit 20 is connected to the storage unit 10, the data in the interaction process can be written into the storage unit 10.
[0056] Similarly, when the external device is a second device, assuming that the second device can provide 5V DC power to the data reading and writing device 100 through the interface unit 30, at this time, the sampling voltage V1 of the negative input terminal -IN of the comparator U1 to the power supply terminal 31 is less than the reference voltage Vref, and the output of the comparator U1 is low level. When receiving the low level, the switching unit 42 selects the second communication branch. Based on this, the second device can exchange data with the control unit 20 through the interface unit 30, the switching unit 42 and the first communication branch. Because the control unit 20 is connected to the storage unit 10, the data stored in the storage unit 10 can be uploaded to the second device during the interaction.
[0057] As an embodiment, the switching unit 42 includes a first type communication terminal 421 and a second type communication terminal 422. The first type communication terminal 421 is used to connect to a first communication terminal of the control unit 20, and the second type communication terminal 422 is used to connect to a second communication terminal of the control unit 20.
[0058] In this embodiment, the switching unit 42 is connected to the first communication terminal of the control unit 20 through the first communication terminal 421 to form a first communication branch. It is connected to the second communication terminal of the control unit 20 through the second communication terminal 422 to form a second communication branch. Here, the switching unit 42 can determine to exchange data with the control unit 20 through the first communication terminal 421 or the second communication terminal 422 according to the transmission level of the output terminal OUT of the comparator U1. That is, it is determined to select the first communication branch or the second communication branch.
[0059] Figure 4 The specific structural diagram of the communication switching unit in a data reading and writing device provided in an embodiment of the present application is shown. Figure 3 and Figure 4As an embodiment, the switching unit 42 at least includes a switching chip U2 and a communication chip U3. The voltage detection terminal of the switching chip U2 is connected to the output terminal of the comparator U1, the first pin pair of the switching chip U2 serves as the second type of communication terminal 422, the second pin pair of the switching chip U2 is connected to the first transmission terminal of the communication chip U3, and the second transmission terminal of the communication chip U3 serves as the first type of communication terminal 421.
[0060] In this embodiment, the switching chip U2 can switch the communication branch according to the level of the output terminal OUT of the comparator U1. Here, in order to achieve physical isolation between the first communication branch and the second communication branch, the first pin pair of the switching chip U2 can be used as the second type of communication terminal 422, and the second pin of the switching chip U2 can be used to form the first type of communication terminal 421 through the communication chip U3, so that the switching chip U2 can be used to switch the communication branch according to the level of the output terminal OUT of the comparator U1.
[0061] Figure 5 The specific circuit diagram of the communication switching unit in a data reading and writing device provided in an embodiment of the present application is shown. Figures 3 to 5 , the comparator U1 is connected to the first end of the first sampling resistor 1R1, and the first end of the first sampling resistor 1R1 is connected in series with the second sampling resistor 1R2. The second end of the first sampling resistor 1R1 is used as a sampling end to connect to the power supply end 31. Here, the first sampling resistor 1R1 and the second sampling resistor 1R2 are connected in series, so the voltage of the power supply end 31 can be divided, and the divided voltage is used as the sampling voltage and transmitted to the negative input end of the comparator U1. The positive input end of the comparator U1 is connected to a preset power supply, that is, the voltage provided by the preset power supply is input as a reference voltage. The comparator U1 is used to compare the sampling voltage with the reference voltage, and then the comparison result is transmitted to the switching unit 42 in a high level or low level manner. Figure 5 As an embodiment, the switching chip U2 may include a first chip U21 and a second chip U22 connected to the first chip U21. The first chip U21 is connected to the interface unit through pins (BUS_N, BUS_P). The SEL end of the second chip U22 is connected to the output end OUT of the comparator U1.
[0062] Combination Figures 3 to 5 , the first pair of transmission terminals (D+, D-) of the second chip U22 is used as the second type of communication terminal 422. The second pair of transmission terminals (M+, M-) of the second chip U22 is used to connect to the communication chip U3. The transmission terminals (D, R) of the communication chip U3 are used as the first type of communication terminal 421.
[0063] Combination Figures 3 to 5As an example, when the external device connected to the interface unit 30 is the first device, the negative input terminal of the comparator U1 can sample the power supply terminal 31 of the interface unit 30 through the first sampling resistor 1R1 to obtain a first sampling voltage. Here, the first sampling voltage is equal to or greater than the preset voltage, so at this time, the output terminal OUT of the comparator U1 transmits a high level to the SEL terminal of the second chip U22. Under the action of the high level, the second chip U22 chooses to communicate through the second pair of transmission terminals (M+, M-), and then the communication chip U3 connected through the second pair of transmission terminals (M+, M-) is turned on with the control unit 20. The first device can transmit data to the pins (BUS_N, BUS_P) of the first chip U21 through the interface unit, and transmit it to the communication chip U3 through the second pair of transmission terminals (M+, M-) of the second chip U22, and then the communication chip U3 transmits it to the control unit 20 through the transmission terminal (D, R). After receiving the data, the control unit 20 can write the data into the storage unit 10.
[0064] As another example, when the external device connected to the interface unit 30 is a second device, the negative input terminal of the comparator U1 can sample the power supply terminal 31 of the interface unit 30 through the first sampling resistor 1R1 to obtain a second sampling voltage. Here, the second sampling voltage is less than the preset voltage, so at this time, the output terminal OUT of the comparator U1 transmits a low level to the SEL terminal of the second chip U22. Under the action of the low level, the second chip U22 chooses to communicate through the first pair of transmission terminals (D+, D-), and then uses the first pair of transmission terminals (D+, D-) as the second communication branch between the second type of communication terminal 422 and the control unit 20. At this time, the control unit 20 can read data from the storage unit 10, and send it to the second chip U22 through the first pair of transmission terminals (D+, D-), which is then transmitted to the first chip U21 by the second chip U22, and then the first chip U21 uploads the data to the second device through the interface unit 30 through the pins (BUS_N, BUS_P).
[0065] Figure 6 The following is a flowchart of a data reading and writing method provided in an embodiment of the present application. It should be noted that the data reading and writing method provided in this embodiment is applied to Figure 1 The data reading and writing device provided in the embodiment. Figure 1 In all embodiments of the present application, the execution subject of the data reading and writing method may be the control unit 20 in the data reading and writing device 100. Figure 6 As shown, the data reading and writing method specifically includes:
[0066] S601: When a first communication branch is turned on, first data of a first device is written into a storage unit, wherein the first communication branch is a path selected by a communication switching unit when an interface unit is connected to the first device.
[0067] S602: When the second communication branch is turned on, the second data read from the storage unit is sent to the second device, and the second communication branch is a path selected by the communication switching unit when the interface unit is connected to the second device.
[0068] Combination Figure 1 In this embodiment, the interface unit 30 refers to a physical interface for connecting an external device provided on the data reading and writing device 100. The external device generally refers to a device that can exchange data with the data reading and writing device 100 through the interface unit 30. For example, a first device for writing data to the data reading and writing device 100, or a second device for reading data from the data reading and writing device 100.
[0069] Here, the interface unit 30 can only be connected to one external device at a certain time. For example, when the interface unit 30 is connected to the first device, it is not connected to the second device. For another example, when the interface unit 30 is connected to the second device, it is not connected to the first device. Based on this, for the storage unit 10 in the data reading and writing device 100, at a certain time, when the external device connected to the interface unit 30 does not change, the data reading and writing state of the storage unit 10 does not change.
[0070] As an embodiment, step S601 includes:
[0071] When the first communication branch is turned on, a data write request is sent to the first device through the first communication branch, and first data returned by the first device according to the data write request is received.
[0072] As an embodiment, step S602 includes:
[0073] When the second communication branch is turned on, a data read request sent by the second device is received through the second communication branch, and second data is returned to the second device in response to the data read request.
[0074] In this embodiment, the first device is used to return the first data to the control unit 20 through the first communication branch according to the data write request. The second device is used to send a data read request to the control unit 20 through the second communication branch, and receive the second data returned by the control unit 20 through the second communication branch.
[0075] Understandably, due to Figure 1In the illustrated embodiment, the specific implementation method of conducting the first communication branch and conducting the second communication branch has been illustrated, so the specific implementation method and working principle of the communication switching unit 40 will not be described in detail here.
[0076] In this embodiment, Figure 5 The steps S601 and S602 shown in the figure may be parallel steps or steps in a sequential order. For example, after executing step S601, step 602 may not be executed, or step S602 may be executed directly without executing step S601. For another example, step S601 may be executed first and then step S602, which is not limited here.
[0077] As an embodiment, step S601 further includes, when the first communication branch is turned on, instructing the storage unit 10 to enter a data write mode and writing the first data into the storage unit 10 .
[0078] In this embodiment, when the first communication branch is connected, it means that the interface unit 30 is connected to the first device, and a data write request can be sent to the first device to read the data stored in the first device, such as the log data and / or control parameters of the first device.
[0079] Here, the control unit 20 instructs the storage unit 10 to enter a data write mode, which may be specifically to reset and initialize the storage unit 10, and to provide a write signal to the storage unit 10, so that when the storage unit 10 receives the first data obtained by the control unit 20 through the first communication branch, it can write the first data into the storage space of the storage unit 10 for storage according to the write signal.
[0080] As an embodiment, step S602 further includes, when the second communication branch is turned on, instructing the storage unit 10 to enter a data read mode, and sending the second data read from the storage unit 10 to the second device.
[0081] In this embodiment, when the second communication branch is connected, it means that the interface unit 30 is connected to the second device, and at this time, a data read request sent by the second device can be received, and then the data stored in the storage unit 10 can be read, such as the log data and / or control parameters of the first device.
[0082] Here, the control unit 20 instructs the storage unit 10 to enter the data read mode, specifically, it can send a command to the storage unit 10, so that the storage unit 10 can respond according to the command, so that the control unit 20 can read the second data stored in the storage unit 10. Then, it is uploaded to the second device through the second communication branch and the interface unit 30.
[0083] The above scheme provides a data reading and writing method. When the first communication branch is turned on, the first data sent by the first device is written into the storage unit 10. When the second communication branch is turned on, the second data read from the storage unit 10 is sent to the second device. In this way, the data of the first device stored in the storage unit 10, such as log data, can be read from the first device first. When connected to the second device through the interface unit 30, the data stored in the storage unit 10 is sent to the second device. Even if the first device is set in a special environment, it is not necessary to disassemble the first device or connect the second device to the first device, and data can be read from the first device, which provides a new way to realize data reading and writing between the first device and the second device.
[0084] In addition, when the data reading and writing device 100 is connected to a first device, the first device can directly write the first data into the storage unit 10 of the data reading and writing device 100 through the first communication branch. When the data reading and writing device 100 is connected to a second device, the data reading and writing device 100 can automatically switch the path so that the second device can read the second data from the storage unit 10 through the second communication branch.
[0085] Figure 7 A log reading and writing system 200 provided in this embodiment is shown, comprising an external device 110 and a data reading and writing apparatus 100 provided in any of the above embodiments.
[0086] Combination Figure 1 , Figure 2 or Figure 3 In this embodiment, the external device 110 may include a first device and a second device. The log data generated by the first device is read and recorded by the data reading and writing device 100, and the second device reads the log data from the data reading and writing device 100.
[0087] Exemplarily, in a specific implementation, when the external device is a first device, the data read-write device 100 may send a data write request, such as a log data write request, to the first device. The first device may determine the log data according to the data write request, and return the log data to the control unit 20 of the data read-write device 100 through the first communication branch. Alternatively, the first device may determine the log data autonomously, for example, after the first device generates the log data, the log data may be returned to the control unit 20 of the data read-write device 100 through the first communication branch. The control unit 20 of the data read-write device 100 receives the log data returned by the first device through the first communication branch, and writes the log data into the storage unit 10. When the external device is a second device, the second device may send a data read request, such as a log data read request, to the control unit 20 of the data read-write device 100 through the second communication branch. The control unit 20 of the data read-write device 100 responds to the data read request, reads the log data from the storage unit 10, and returns the log data to the second device through the second communication branch. The second device receives the log data returned by the control unit 20 through the second communication branch.
[0088] It can be understood that the log reading and writing system 200 provided in this embodiment, the improvements and specific implementation methods related to this application have been Figures 1 to 5 The corresponding data reading and writing device 100 is described in detail in the embodiment, so please refer to Figures 1 to 5 ,as well as Figures 1 to 5 The relevant descriptions in the corresponding embodiments are not repeated here.
[0089] Those skilled in the art can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example. In actual applications, the above-mentioned functions can be assigned to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiments can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units.
[0090] The embodiments described above are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, a person skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application, and should all be included in the protection scope of the present application.
Claims
1. A data reading and writing device, characterized in that: include: A storage unit for storing data; A control unit connected to the storage unit; An interface unit, used to connect an external device; wherein the external device includes a first device and a second device; a communication switching unit connected between the interface unit and the control unit, the communication switching unit being used to, when the interface unit is connected to the first device, enable a first communication branch between the interface unit and the control unit, and when the interface unit is connected to the second device, enable a second communication branch between the interface unit and the control unit; The control unit is further configured to, when the first communication branch is turned on, write the first data of the first device into the storage unit, and when the second communication branch is turned on, send the second data read from the storage unit to the second device.
2. The data reading and writing device according to claim 1, characterized in that: The control unit is further configured to, when the first communication branch is conductive, send a data write request to the first device through the first communication branch, and when the second communication branch is conductive, receive a data read request sent by the second device through the second communication branch; The first device is used to determine the first data according to the data write request, and return the first data to the control unit through the first communication branch; The second device is used to send the data read request to the control unit through the second communication branch, and receive the second data returned by the control unit through the second communication branch.
3. The data reading and writing device according to claim 2, characterized in that: The communication switching unit comprises: a comparing unit connected to the power supply end of the interface unit, the comparing unit being configured to output a first electrical signal when it is determined according to the voltage of the power supply end that the interface unit is connected to the first device, and output a second electrical signal when it is determined according to the voltage of the power supply end that the interface unit is connected to the second device, wherein the voltage of the first electrical signal is not equal to the voltage of the second electrical signal; A switching unit is connected to the comparing unit and is used to select the first communication branch according to the first electrical signal and select the second communication branch according to the second electrical signal.
4. The data reading and writing device according to claim 3, characterized in that: The comparison unit at least includes: a comparator; The positive input terminal of the comparator is used to input a reference voltage, the negative input terminal of the comparator is used to connect to the power supply terminal, and the output terminal of the comparator is used to connect to the switching unit.
5. The data reading and writing device according to claim 4, characterized in that: The switching unit includes a first type of communication terminal and a second type of communication terminal; The first type of communication terminal is used to connect to a first communication terminal of the control unit, and the second type of communication terminal is used to connect to a second communication terminal of the control unit.
6. The data reading and writing device according to claim 5, characterized in that: The switching unit at least includes a switching chip and a communication chip; The voltage detection end of the switching chip is connected to the output end of the comparator, the first pin pair of the switching chip serves as the first type of communication end, the second pin pair of the switching chip is connected to the first transmission end of the communication chip, and the second transmission end of the communication chip serves as the second type of communication end.
7. The data reading and writing device according to claim 1, characterized in that: The control unit is further configured to, when the first communication branch is turned on, instruct the storage unit to enter a data write mode and write the first data into the storage unit.
8. The data reading and writing device according to claim 1, characterized in that: The control unit is further configured to, when the second communication branch is turned on, instruct the storage unit to enter a data read mode, and send the second data read from the storage unit to the second device.
9. A data reading and writing method, characterized in that: Applicable to the data reading and writing device according to any one of claims 1 to 8, the data reading and writing method comprising: When the first communication branch is turned on, the first data of the first device is written into the storage unit, wherein the first communication branch is a path selected by the communication switching unit when the interface unit is connected to the first device; When the second communication branch is turned on, the second data read from the storage unit is sent to the second device. The second communication branch is a path selected by the communication switching unit when the interface unit is connected to the second device.
10. A log reading and writing system, characterized in that: It comprises an external device and the data reading and writing device according to any one of claims 1 to 8; The external device includes a first device and a second device, the log data generated by the first device is read and recorded by the data reading and writing device, and the second device reads the log data from the data reading and writing device.