USB-HID data analysis converter
By designing a USB-HID data analysis converter, the problems of short communication distance and poor anti-interference performance of USB-HID devices in industrial control sites are solved, high-performance and low-cost access of the device is achieved, maintenance costs are reduced, and the use of equipment is supported by different brands.
Patent Information
- Application Number
- CN201911318702.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2019-12-19
- Publication Date
- 2025-04-25
- Estimated Expiration
- 2039-12-19
AI Technical Summary
In industrial control sites, USB-HID human-computer interactive devices cannot access control equipment at high performance and low cost due to short communication distance, poor anti-interference performance and poor stability. The existing RS-232 serial bus interface equipment is costly, incomplete, poor data resolution capabilities, high application cost and poor real-time performance.
A USB-HID data analysis converter is designed, including a USB interface, a microprocessor, a serial communication interface and a data format selection switch. The USB data is received through the microprocessor for analysis and conversion, forming serial port data, and sending it to the control device through the serial communication interface. The data format selection switch allows users to select a suitable serial port data format.
It realizes the convenient, fast and low-cost access of USB-HID interactive devices to PLC, motion controller and servo controller, which improves the convenience of use of input devices, reduces maintenance risks and maintenance costs, and supports the use of USB-HID devices of different brands and performances.
Smart Images

Figure CN110825676B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of USB communication technology, and in particular to a USB-HID data analysis converter. Background Art
[0002] In industrial control sites, control devices such as PLC programmable logic controllers (PLC), motion controllers, and servo controllers need to be directly connected to input devices such as scanners and keyboards. They can only choose or customize dedicated input devices with RS-232 serial bus interfaces.
[0003] With the popularity of USB (Universal Serial Bus), the number of input devices such as scanners and keyboards using USB-HID human-machine interaction device protocols has gradually increased in the market. The above-mentioned input devices with RS-232 serial bus interfaces have been gradually discontinued and withdrawn from the market. However, due to the short communication distance of USB universal serial bus, poor anti-interference performance of long-distance transmission, poor stability and other shortcomings, it is not suitable for large-scale use in industrial control sites, resulting in the inability of input devices to access control devices with high performance and low cost in the fields of automatic control and industrial control. When directly selecting or customizing dedicated input devices with RS-232 serial bus interfaces, there are problems such as high cost, incomplete functions, and poor data parsing ability. When input devices such as scanners and keyboards that indirectly use USB-HID human-machine interaction device protocols are connected to computers, and the input data is parsed and processed by the USB-HID protocol driver pre-installed in the computer operating system, and then uploaded to the industrial control bus using relevant industrial control software, and sent to the control device, there are problems such as extremely high application cost and low real-time performance.
[0004] In addition, when control equipment manufacturers access input devices with RS-232 serial bus interfaces, due to the non-uniform message protocol formats of such devices, they need to adapt one brand to one device. They can only use input devices of a single brand and use such input devices as part of the overall control device unit, rather than making them independent input modules with standard interfaces and standard protocols. This results in the inability to flexibly replace input devices of different brands and performances, greatly increasing maintenance risks and costs. Summary of the invention
[0005] The present invention aims to solve one of the technical problems in the related art at least to a certain extent. To this end, the purpose of the present invention is to provide a USB-HID data parsing converter.
[0006] To achieve the above object, a USB-HID data parsing converter according to an embodiment of the present invention includes:
[0007] USB interface, used to connect USB-HID interactive devices;
[0008] A microprocessor connected to the USB interface, configured to receive USB data inputted by the USB interface, and parse and convert the data to form serial port data;
[0009] A serial communication interface, the serial communication interface is connected to the microprocessor and is used to send the serial port data to a control device;
[0010] A data format selection switch is connected to the microprocessor and is used for a user to operate and select a serial port data format output by the serial communication interface.
[0011] According to the USB-HID data analysis converter provided by the embodiment of the present invention, the USB interface can be converted to the serial communication interface, so that the USB-HID interactive device (for example: barcode scanner, keyboard and other devices) can be conveniently, quickly and low-costly connected to the control devices such as PLC programmable logic controller, motion controller and servo controller. In addition, the USB-HID data analysis converter of the present invention has a data format selection switch, which can be operated by the user to select the serial port data format output by the serial communication interface. In this way, the control equipment manufacturer can use the USB-HID data analysis converter of the present invention as the interface end of the USB-HID machine interaction device, which is convenient for matching with USB-HID machine interaction devices of different brands, different performances and different functions widely sold on the market, improve the convenience of using the input device, and improve the maintenance risk and maintenance cost caused by failure, loss and other reasons of the input device.
[0012] In addition, the USB-HID data parsing converter according to the above embodiment of the present invention may also have the following additional technical features:
[0013] According to an embodiment of the present invention, the data format selection switch includes at least a first switch and a second switch, and the microprocessor is used to control the serial communication interface to selectively output one of multiple formats according to the state combination of the first switch and the second switch.
[0014] According to an embodiment of the present invention, it further comprises a status indication circuit, which is connected to the microprocessor and is used to indicate the USB interface status or the data receiving status.
[0015] According to an embodiment of the present invention, the state indication circuit includes a relay, and the relay is connected to the microprocessor to be opened or closed under the control of the microprocessor.
[0016] According to one embodiment of the present invention, the relay is a solid-state relay, the anode of the solid-state relay is connected to a DC power supply via a resistor, the cathode of the solid-state relay is connected to the microprocessor, and the two output controlled ends of the solid-state relay are suitable for being connected to the control device.
[0017] According to an embodiment of the present invention, the two output controlled terminals of the fixed relay are also grounded through a TVS diode respectively.
[0018] According to one embodiment of the present invention, the serial communication interface includes an RS-232 interface and an RS-485 interface.
[0019] According to one embodiment of the present invention, it further comprises a logic gate, wherein two input ends of the logic gate are respectively connected to the RS-232 interface and the RS-485 interface, and the output end of the logic gate is connected to the microprocessor.
[0020] According to one embodiment of the present invention, the model of the microprocessor is VNC2, the model of the RS-232 interface is ST3222EB, the model of the RS-485 interface is ADM3485E, and the logic gate is M74VHC1GT08.
[0021] Additional aspects and advantages of the present invention will be given in part in the following description and in part will be obvious from the following description, or will be learned through practice of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. 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 the structures shown in these drawings without paying creative work.
[0023] Figure 1 It is a principle block diagram of a USB-HID data analysis converter according to an embodiment of the present invention;
[0024] Figure 2 4 is a circuit diagram of a USB-HID data analysis converter according to an embodiment of the present invention.
[0025] The realization of the purpose, functional features and advantages of the present invention will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0026] The embodiments of the present invention are described in detail below, and examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are intended to be used to explain the present invention, but are not to be construed as limiting the present invention. All other embodiments obtained by ordinary technicians in the field without creative work based on the embodiments of the present invention are within the scope of protection of the present invention.
[0027] In the description of the present invention, it is to be understood that the terms “center”, “longitudinal”, “lateral”, “length”, “width”, “thickness”, “up”, “down”, “front”, “back”, “left”, “right”, “vertical”, “horizontal”, “top”, “bottom”, “inside”, “outside”, “clockwise”, “counterclockwise”, “axial”, “circumferential”, “radial”, etc., indicating orientations or positional relationships based on the orientations or positional relationships shown in the accompanying drawings, are only for the convenience of describing the present invention 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 limiting the present invention.
[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. Therefore, the features defined as "first" and "second" may explicitly or implicitly include one or more of the features. In the description of the present invention, the meaning of "plurality" is two or more, unless otherwise clearly and specifically defined.
[0029] In the present invention, unless otherwise clearly specified and limited, the terms "installed", "connected", "connected", "fixed" and the like should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection, or it can be an indirect connection through an intermediate medium, or it can be the internal communication of two components. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.
[0030] In the present invention, unless otherwise clearly specified and limited, a first feature being "above" or "below" a second feature may include that the first and second features are in direct contact, or may include that the first and second features are not in direct contact but are in contact through another feature between them. Moreover, a first feature being "above", "above" and "above" a second feature includes that the first feature is directly above and obliquely above the second feature, or simply indicates that the first feature is higher in level than the second feature. A first feature being "below", "below" and "below" a second feature includes that the first feature is directly below and obliquely below the second feature, or simply indicates that the first feature is lower in level than the second feature.
[0031] The USB-HID data parsing converter according to the embodiment of the present invention will be described in detail below with reference to the accompanying drawings.
[0032] Reference Figure 1 As shown, the USB-HID data parsing converter provided according to an embodiment of the present invention includes a USB interface 100 , a microprocessor 200 , a serial communication interface 300 and a data format selection switch 400 .
[0033] Specifically, the USB interface 100 is used to connect the USB-HID interactive device, that is, the USB interface 100 provides a data connection interface as the USB-HID interactive device, and the USB interface 100 can also provide a working power supply (e.g., +5.0V) for the USB-HID interactive device. Specifically, the USB-HID interactive device generally has a connecting line with a USB connector. The USB connector of the connecting line is inserted into the USB interface 100 on the USB-HID data parsing converter of the present invention, so that the USB-HID interactive device and the USB-HID data parsing converter can be connected. The USB data of the USB-HID interactive device can be sent to the microprocessor 200 through the USB interface 100.
[0034] The microprocessor 200 is connected to the USB interface 100, and is used to receive the USB data input by the USB interface 100, and parse and convert the USB data to form serial port data. The microprocessor 200 integrates functions such as a universal asynchronous receiver / transmitter UART (Universal Asynchronous Receiver / Transmitter), a USB host controller USB-HOST, and a general purpose input / output port GPIO (General Purpose Input / Output). When a USB-HID interactive device is connected to the USB interface 100, the USB host controller USB-HOST can provide host services for the USB-HID human-computer interactive device, receive and process the USB data transmitted by the USB-HID interactive device, complete data parsing and conversion, to form serial port data, and send it to the serial communication interface through the internal universal asynchronous receiver / transmitter UART.
[0035] The serial communication interface 300 is connected to the microprocessor 200 to send the serial port data to the control device. The serial communication interface 300 is one of the data transceiver interfaces of the USB-HID data parser and converter, which can send the serial port data sent by the universal asynchronous receiver and transmitter UART inside the microprocessor in the RS-232 electrical standard. It can also receive information transmitted in the RS-232 electrical standard and transmit it to the universal asynchronous receiver and transmitter UART inside the microprocessor 200.
[0036] Optionally, the serial communication interface 300 includes an RS-232 interface 301 and an RS-485 interface 302. Thus, the two serial communication interfaces can provide more flexible options to meet user needs.
[0037] The data format selection switch 400 is connected to the microprocessor 200, and is used for the user to operate and select the serial port data format output by the serial communication interface 300. Since the message protocol formats of control devices and USB-HID interactive devices of different brands and manufacturers are not uniform, a control device of one brand needs to be configured with a corresponding brand of USB-HID interactive device, which causes limitations when users select and use control devices and USB-HID interactive devices. The USB-HID data parsing converter provided by the present invention can use the data format selection switch 400 to select the serial port data format output by the serial communication interface 300, so that the user can select the protocol format that the USB-HID interactive device and the control device are compatible.
[0038] The USB-HID data analysis converter provided by the embodiment of the present invention can convert the USB interface 100 and the serial communication interface 300, so that the USB-HID interactive device (for example, a barcode scanner, a keyboard and other devices) can be conveniently, quickly and cost-effectively connected to control devices such as a PLC programmable logic controller, a motion controller and a servo controller. The USB-HID data analysis converter of the present invention has an RS-485 interface, which can realize the networking of multiple USB-HID interactive devices on one bus, and compared with the input device with an RS-232 interface, it reduces the purchase cost of the communication conversion module; and realizes the ultra-long-distance remote transmission of USB-HID interactive device data information. The USB-HID data analysis converter of the present invention has a data format selection switch 400, and the data format selection switch 400 can be operated by a user to select the serial port data format output by the serial communication interface 300. In this way, the control equipment manufacturer can use the USB-HID data analysis converter of the present invention as the interface end of the USB-HID machine interaction device, which is convenient for matching with USB-HID machine interaction devices of different brands, different performances, and different functions widely sold on the market, thereby improving the convenience of using the input device and reducing the maintenance risk and maintenance cost caused by failures, losses, etc. of the input device.
[0039] In addition, with the popularity of USB-HID interactive devices using Bluetooth wireless technology, the combination of USB-HID interactive devices using Bluetooth wireless technology and the USB-HID data analysis converter of the present invention can more efficiently solve the wireless application of industrial control field input devices. Take the automobile interior assembly control equipment as an example: automobile interior assembly requires precise process control and recording of full node data. Input devices with RS-232 serial bus interfaces are often inconvenient to use due to entangled lines, and even interfere with the assembly process; using the USB-HID data analysis converter of the present invention and adapting it to the USB-HID interactive device with Bluetooth wireless technology can effectively improve such problems.
[0040] In one embodiment of the present invention, the data format selection switch 400 includes at least a first switch M0 and a second switch M1, and the microprocessor 200 is used to control the serial communication interface 300 to selectively output one of multiple formats according to the state combination of the first switch M0 and the second switch M1.
[0041] That is, the user can switch the different states of the first switch M0 and the second switch M1, and then select the serial port data format output by the serial communication interface 300. For example, the first switch M0 and the second switch M1 can be combined to form four combination states, and then four data formats are set respectively, as shown in the following table:
[0042]
[0043]
[0044] In this way, by utilizing the combination state of the first switch M0 and the second switch M1, four data formats can be selected, satisfying the convenience of the user in selecting and using the control device and the USB-HID interactive device.
[0045] In one embodiment of the present invention, a status indication circuit 500 is further included. The status indication circuit 500 is connected to the microprocessor 200 to indicate the USB interface status or the data receiving status. In this way, during use, the user can obtain the USB interface status through the status indication circuit, that is, whether the USB interface 100 is connected to a USB-HID interactive device, or obtain whether the USB-HID data parsing converter has received data through the status indication circuit 500, thereby facilitating the user to correctly use the USB-HID data parsing converter.
[0046] Specifically, refer to Figure 2 As shown, the status indication circuit 500 may include a relay K1, which is connected to the microprocessor 200 and is used to open or close under the control of the microprocessor 200. In specific use, the output end of the relay K1 can be connected to a control device (such as a PLC controller). In this way, when the relay K1 is opened or closed, a status signal can be output to the control device, and the control device can obtain the USB interface status or the data receiving status according to the status signal.
[0047] Preferably, the relay K1 is a solid-state relay, the anode of the solid-state relay is connected to a DC power supply +3.3V through a resistor R1, the cathode of the solid-state relay is connected to the microprocessor 200, and the two output controlled terminals PORT and P_COM of the solid-state relay are suitable for being connected to the control device, that is, in specific use, the two output controlled terminals PORT and P_COM of the fixed relay are connected to the control device, when the microprocessor 200 controls the fixed relay to open or close, the output controlled terminals PORT and P_COM of the solid-state relay can output status signals to the control device.
[0048] In this embodiment, a fixed relay is used. Based on the characteristics of the fixed relay such as no contact, long life, high reliability, safe use, and low electromagnetic interference, it can ensure that the performance of the USB-HID data analysis converter of the present invention is reliable and stable, and the service life is longer.
[0049] Advantageously, the two output controlled terminals PORT and P_COM of the fixed relay are grounded through a TVS diode (transient voltage suppression diode), respectively. Thus, the TVS diode can provide overvoltage protection for the status indication circuit.
[0050] In one embodiment of the present invention, a logic gate 202 is further included, wherein two input ends of the logic gate 202 are respectively connected to the RS-232 interface 301 and the RS-485 interface 302, and an output end of the logic gate 202 is connected to the microprocessor 200. Since the RS-232 interface 301 and the RS-485 interface 302 in this embodiment share one receiving pin on the microprocessor 200, in this embodiment, a logic gate 202 is provided to solve the competition and risk problems of the two-way signals of the RS-232 interface 301 and the RS-485 interface 302.
[0051] Reference Figure 2 As shown, Figure 2 The exemplary circuit structure of the USB-HID data parsing converter provided by the embodiment of the present invention is shown. For the convenience of explanation, only the part related to the embodiment of the present invention is shown. Figure 2 , the working process of the USB-HID data parsing converter of the present invention is described:
[0052] The crystal oscillator Y1 provides a working clock for the microprocessor 200 .
[0053] Pins USB1 DM and USB1 DP of the USB host controller USB-HOST of the microprocessor 200 are connected to the USB connector through series resistors R2 and R4 respectively, and serve as data information or command information input.
[0054] Pins IO BUS2 and IO BUS3 of the general purpose input / output port GPIO of the microprocessor 200 are connected to the first data format selection switch M0 and the second data format selection switch M1 respectively, and function as a selection signal input.
[0055] The pin IO BUS1 of the general purpose input / output port GPIO of the microprocessor 200 is connected to the cathode pin of the relay K1. When the pin IO BUS1 outputs a low level, the relay K1 is closed, otherwise it is opened.
[0056] The GPIO pins IO BUS10 and IO BUS11 of the microprocessor 200 are respectively connected to the enable control pins of the RS-232 conversion chip U2. and shutdown control signal pin When the IO BUS10 pin outputs a low level and the IO BUS11 pin outputs a high level, the RS-232 conversion chip U2 works normally; when the IO BUS10 pin outputs a high level and the IO BUS11 pin outputs a low level, the RS-232 conversion chip U2 enters a low power consumption mode.
[0057] The GPIO pins IO BUS8 and IO BUS9 of the microprocessor 200 are respectively connected to the transmit enable pin DE and receive enable pin DE of the RS-485 conversion chip U3. When the IO BUS8 pin outputs a low level and the IO BUS9 pin outputs a low level, the RS-485 conversion chip U3 operates in the differential receiving mode; when the IO BUS8 pin outputs a high level and the IOBUS9 pin outputs a high level, the RS-485 conversion chip U3 operates in the differential sending mode; when the IO BUS8 pin outputs a low level and the IO BUS9 pin outputs a high level, the RS-485 conversion chip U3 operates in the low power consumption mode.
[0058] The transmit data pin TXD of the universal asynchronous receiver / transmitter UART of the microprocessor 200 is respectively connected to the data receive pin T2 IN of the RS-232 conversion chip U2 and the data receive pin DI of the RS-485 conversion chip U3, and the receive data pin RXD of the universal asynchronous receiver / transmitter UART is connected to the logic gate chip U4; the input pins A and B of the logic gate chip U4 are respectively connected to the data output pin R2OUT of the RS-232 conversion chip U2 and the data output pin RO of the RS-485 conversion chip U3.
[0059] The T2 OUT and T2 IN pins of the RS-232 conversion chip U2 are respectively connected to the external receiving signal and transmitting signal that comply with the RS-232 bus electrical standard.
[0060] A matching resistor R3 is connected in series between the A+ and B- pins of the RS-485 conversion chip U3, and is respectively connected to external A+ and B- differential signals that comply with the RS-485 bus electrical standard.
[0061] The microprocessor 200 provides host services for the USB-HID interactive device, receives and processes the USB data transmitted by the USB-HID interactive device, automatically completes data parsing and conversion to form serial port data, and sends it to the RS-232 conversion chip U2 or RS-485 conversion chip U3 through the internal universal asynchronous receiver and transmitter UART. The microprocessor 200 also supports parsing data reading, function setting and command execution by receiving AT commands or ModbusRTU instructions.
[0062] The specific working process takes the scanner connected to the USB-HID interactive device as an example: in the automatic sending mode of the USB-HID data parsing converter, when the data format is set to format 1, the scanner is connected to the USB interface 100 of the USB-HID data parsing converter. After scanning the barcode "0123456789" with the scanner, the microprocessor 200 will automatically complete the USB-HID data parsing and conversion and send the parsed data in the form of ASCII code "0123456789" through the serial communication interface 300.
[0063] In the embodiment of the present invention, the model of the microprocessor 200 is VNC2, the model of the RS-232 conversion chip is ST3222EB, the model of the RS-485 conversion chip is ADM3485E, and the model of the logic gate chip is M74VHC1GT08.
[0064] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner. In addition, those skilled in the art may combine and combine the different embodiments or examples described in this specification and the features of the different embodiments or examples, without contradiction.
[0065] The above description is only a preferred embodiment of the present invention, and does not limit the patent scope of the present invention. All equivalent structural changes made by using the contents of the present invention specification and drawings under the inventive concept of the present invention, or directly / indirectly applied in other related technical fields are included in the patent protection scope of the present invention.
Claims
1. A USB-HID data analysis converter, characterized in that: include: USB interface, used to connect USB-HID interactive devices; A microprocessor connected to the USB interface, configured to receive USB data inputted by the USB interface, and parse and convert the data to form serial port data; A serial communication interface, the serial communication interface is connected to the microprocessor and is used to send the serial port data to a control device; A data format selection switch, the data format selection switch is connected to the microprocessor and is used for a user to operate and select a serial port data format output by the serial communication interface; The microprocessor is internally integrated with a universal asynchronous receiver and transmitter UART and a USB host controller USB-HOST. When the USB interface is connected to the USB-HID interactive device, the USB host controller USB-HOST provides a host service for the USB-HID interactive device, receives and processes USB data transmitted by the USB-HID interactive device, completes data parsing and conversion to form serial port data, and sends the serial port data to the serial communication interface through the universal asynchronous receiver and transmitter UART. The data format selection switch includes at least a first switch and a second switch, and the microprocessor is used to control the serial communication interface to selectively output one of multiple formats according to the state combination of the first switch and the second switch.
2. The USB-HID data analysis converter according to claim 1, characterized in that: It also includes a status indication circuit, which is connected to the microprocessor and is used to indicate the USB interface status or the data receiving status.
3. The USB-HID data analysis converter according to claim 2, characterized in that: The state indication circuit comprises a relay, which is connected to the microprocessor and is used for opening or closing under the control of the microprocessor.
4. The USB-HID data analysis converter according to claim 3, characterized in that: The relay is a solid-state relay, the anode of the solid-state relay is connected to a DC power supply through a resistor, the cathode of the solid-state relay is connected to the microprocessor, and the two output controlled terminals of the solid-state relay are suitable for being connected to the control device.
5. The USB-HID data analysis converter according to claim 4, characterized in that: The two output controlled terminals of the solid-state relay are also grounded through a TVS diode respectively.
6. The USB-HID data analysis converter according to claim 1, characterized in that: The serial communication interface includes an RS-232 interface and an RS-485 interface.
7. The USB-HID data analysis converter according to claim 6, characterized in that: It also includes a logic gate, wherein two input ends of the logic gate are respectively connected to the RS-232 interface and the RS-485 interface, and the output end of the logic gate is connected to the microprocessor.
8. The USB-HID data analysis converter according to claim 7, characterized in that: The model of the microprocessor is VNC2, the model of the RS-232 interface is ST3222EB, the model of the RS-485 interface is ADM3485E, and the logic gate is M74VHC1GT08.
Citation Information
Patent Citations
System for forecasting mine water regime and intelligently controlling drainage
CN101979838A
Multi-protocol communication conversion method
CN103905403A
USB-HID data analysis converter
CN210639613U