Data acquisition circuit, data acquisition control method and data acquisition system
By introducing a combination of multiple acquisition modules and main control modules into the data acquisition system, high-precision conversion of analog data and Ethernet data upload are realized, which solves the problem of low accuracy of traditional data acquisition systems and improves the data acquisition efficiency of distributed measurement systems.
Patent Information
- Application Number
- CN202510410837.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-02
- Publication Date
- 2025-07-25
AI Technical Summary
Traditional data acquisition systems have low test accuracy in distributed measurement systems, making it difficult to meet the requirements of data acquisition accuracy and efficiency.
The data acquisition circuit consisting of multiple acquisition modules, network port submodules, first DSP submodules and the main control module of the first CAN transceiver is realized by converting analog data into CAN signals, differential signal modulation and Ethernet data upload.
It improves the accuracy and flexibility of the data acquisition process, expands the application of the acquisition module, and enhances the reliability and stability of data transmission.
Smart Images

Figure CN120370779A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the technical field of data acquisition, and particularly to a data acquisition circuit, a data acquisition control method, and a data acquisition system. Background Art
[0002] In a specific field of distributed measurement systems, the measurement environment it faces generally presents extremely complex characteristics, which may involve the interweaving and influence of various complex factors. Moreover, the distance that data travels during transmission is usually relatively long, which inevitably poses many challenges and problems. In this case, it is usually necessary to collect analog quantities at multiple measurement points.
[0003] However, the testing methods adopted by traditional data acquisition systems are generally cumbersome, the entire process is complex and time-consuming, and there are certain limitations in terms of testing accuracy. It is difficult to meet the requirements of high precision and is difficult to well adapt to the actual needs of distributed measurement systems for data acquisition accuracy and efficiency. Summary of the Invention
[0004] The main purpose of this application is to provide a data acquisition circuit, a data acquisition control method, and a data acquisition system, aiming to solve the technical problem of low testing accuracy of traditional data acquisition systems.
[0005] To achieve the above object, this application proposes a data acquisition circuit, which includes: a plurality of acquisition modules and a main control module including a network port sub-module, a first DSP sub-module, and a first CAN transceiver;
[0006] Both ends of the network port sub-module are respectively connected to the host computer and the first end of the first DSP sub-module, and both ends of the first CAN transceiver are respectively connected to the second end of the first DSP sub-module and the acquisition module;
[0007] The acquisition module is configured to convert the analog quantity data of multiple measurement points collected into CAN signals and transmit the CAN signals to the first CAN transceiver of the main control module;
[0008] The first CAN transceiver is configured to perform signal conversion on the CAN signals and transmit the converted differential signals to the first DSP sub-module;
[0009] The first DSP sub-module is configured to perform data modulation on the differential signals and send the obtained first modulation signals to the network port sub-module;
[0010] The network port sub-module is configured to perform protocol conversion on the modulation signals to obtain Ethernet data and upload the Ethernet data to the host computer.
[0011] In one embodiment, the acquisition module includes: a second CAN transceiver, a second DSP sub-module, and an analog-to-digital acquisition sub-module;
[0012] Two ends of the analog-to-digital acquisition sub-module are respectively connected to a sensor and a first end of the second DSP sub-module, two ends of the second CAN transceiver are respectively connected to a second end of the second DSP sub-module and a CAN bus, and the first CAN transceiver and the second CAN transceiver are communicated through the CAN bus;
[0013] The analog-to-digital acquisition sub-module is configured to perform analog-to-digital conversion on the analog quantity data transmitted by the sensor to obtain corresponding digital signals, and transmit the digital signals to the second DSP sub-module;
[0014] The second DSP sub-module is configured to perform data modulation on the digital signals to obtain CAN signals, and transmit the CAN signals to the second CAN transceiver;
[0015] The second CAN transceiver is configured to transmit the CAN signals to the first CAN transceiver through the CAN bus.
[0016] In one embodiment, the second DSP sub-module includes: a DSP chip and an electrically erasable programmable read-only memory;
[0017] A first end of the DSP chip is connected to the analog-to-digital acquisition sub-module, a second end of the DSP chip is connected to the second CAN transceiver, and a third end of the DSP chip is connected to the electrically erasable programmable read-only memory.
[0018] In one embodiment, the analog-to-digital acquisition sub-module includes: an analog-to-digital conversion chip and a first crystal oscillator;
[0019] An input end of the analog-to-digital conversion chip is connected to the sensor, an output end of the analog-to-digital conversion chip is connected to a first end of the DSP chip, a first clock end of the analog-to-digital conversion chip is connected to a first end of the first crystal oscillator, and a second clock end of the analog-to-digital conversion chip is connected to a second end of the first crystal oscillator.
[0020] In one embodiment, the network interface sub-module includes an Ethernet chip, a transformer, and a second crystal oscillator;
[0021] An input end of the Ethernet chip is connected to a first end of the first DSP sub-module, an output end of the Ethernet chip is connected to an input end of the transformer, an output end of the transformer is connected to a host computer, and a clock end of the Ethernet chip is connected to the second crystal oscillator.
[0022] In addition, to achieve the above object, the present application also proposes a data acquisition control method, which is applied to a data acquisition circuit. The data acquisition circuit includes a plurality of acquisition modules and a main control module. The main control module is respectively connected to the acquisition modules and the host computer. The method is executed by the main control module and includes:
[0023] After the data acquisition circuit is powered on and initialized, determine whether the received current data is Ethernet format data;
[0024] If the current data is the Ethernet format data, perform UDP protocol detection on the current data;
[0025] After the UDP protocol detection passes, parse the current data to obtain command data and a CAN communication frame ID number;
[0026] Convert the command data into CAN command data and transmit the CAN command data to the corresponding acquisition module through the CAN communication frame ID number.
[0027] In an embodiment, the step of performing UDP protocol detection on the current data includes:
[0028] Extract the address message of the current data;
[0029] Judge whether the current data matches the destination address according to the address message;
[0030] When the current data matches the destination address, judge whether the current data matches the UDP port;
[0031] If the current data matches the UDP port, it is determined that the UDP protocol detection of the current data passes.
[0032] In an embodiment, after the step of determining whether the received current data is Ethernet format data after the data acquisition circuit is powered on and initialized, the method further includes:
[0033] If the current data is not the Ethernet format data, judge whether the current data is CAN format data;
[0034] When the current data is the CAN format data, add a UDP data header, an address header, and an Ethernet frame header to the current data to generate Ethernet data, and upload the Ethernet data to the host computer.
[0035] In addition, to achieve the above object, the present application also proposes a data acquisition control method, which is applied to a data acquisition circuit. The data acquisition circuit includes a plurality of acquisition modules and a main control module, and the main control module is respectively connected to the acquisition module and the host computer; the method is executed by the acquisition module, and the method includes:
[0036] When receiving the CAN command data sent by the main control module, collect multiple measurement points to obtain analog data;
[0037] Perform analog-to-digital conversion on the analog data to obtain corresponding CAN signal data;
[0038] Upload the CAN signal data to the main control module, so that the main control module converts the CAN signal data into Ethernet data and uploads the Ethernet data to the host computer.
[0039] In addition, to achieve the above object, the present application also proposes a data acquisition system, which includes the data acquisition circuit as described above, and the data acquisition circuit is configured to implement the steps of the data acquisition control method as described above.
[0040] One or more technical solutions proposed by the present application have at least the following technical effects: The data acquisition circuit of the present application includes: a plurality of acquisition modules and a main control module including a network interface sub-module, a first DSP sub-module, and a first CAN transceiver; both ends of the network interface sub-module are respectively connected to the host computer and the first end of the first DSP sub-module, and both ends of the first CAN transceiver are respectively connected to the second end of the first DSP sub-module and the acquisition module; the acquisition module is used to convert the analog data of multiple measurement points collected into CAN signals and transmit the CAN signals to the first CAN transceiver of the main control module; the first CAN transceiver is used to perform signal conversion on the CAN signals and transmit the converted differential signals to the first DSP sub-module; the first DSP sub-module is used to perform data modulation on the differential signals and send the obtained first modulation signal to the network interface sub-module; the network interface sub-module is used to perform protocol conversion on the modulation signal to obtain Ethernet data and upload the Ethernet data to the host computer. Through this data acquisition circuit, the acquisition module can be flexibly expanded, and the main control module has high conversion accuracy, improving the accuracy of the data acquisition process. Description of the Drawings
[0041] The drawings here are incorporated into the specification and form a part of this specification, showing embodiments consistent with the present application and used together with the specification to explain the principles of the present application.
[0042] To more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the accompanying drawings required for the description of the embodiments or the prior art. Obviously, for those of ordinary skill in the art, without creative efforts, other drawings can also be obtained based on these drawings.
[0043] Figure 1 Schematic connection diagram provided for the first embodiment of the data acquisition circuit of the present application;
[0044] Figure 2 Overall circuit functional block diagram provided for the first embodiment of the data acquisition circuit of the present application;
[0045] Figure 3 Principle block diagram of the acquisition module provided for the first embodiment of the data acquisition circuit of the present application;
[0046] Figure 4 Circuit design diagram of the analog-to-digital acquisition sub-module provided for the first embodiment of the data acquisition circuit of the present application;
[0047] Figure 5 Circuit principle block diagram of the network port sub-module provided for the first embodiment of the data acquisition circuit of the present application;
[0048] Figure 6 Circuit design diagram of the CAN communication provided for the second embodiment of the data acquisition circuit of the present application;
[0049] Figure 7 Schematic diagram of the data conversion process provided for the first embodiment of the data acquisition control method of the present application;
[0050] Figure 8 Command format chart sent from the main control module to the acquisition module provided for the first embodiment of the data acquisition control method of the present application;
[0051] Figure 9 Data format chart for the acquisition module to respond to the main control module provided by the present application;
[0052] Figure 10 Data transmission format chart between the host computer and the main control module provided by the present application;
[0053] Figure 11 Software flow chart of the analog-to-digital acquisition sub-module provided by the present application.
[0054] The realization, functional features, and advantages of the purpose of the present application will be further described with reference to the embodiments and the accompanying drawings. Specific implementation manners
[0055] It should be understood that the specific embodiments described herein are only used to explain the technical solutions of the present application and are not used to limit the present application.
[0056] The following will clearly and completely describe the technical solutions in the embodiments of the present application with reference to the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments in the present application without creative efforts belong to the scope of protection of the present application.
[0057] It should be noted that all directional indications (such as up, down, close to, far from...) in the embodiments of the present application are only used to explain the relative positional relationship and movement conditions between components in a specific posture (as shown in the accompanying drawings). If the specific posture changes, the directional indication will also change accordingly.
[0058] In addition, the descriptions involving "first", "second", etc. in the present application are only for descriptive purposes, and cannot be understood as indicating or implying their relative importance or implicitly indicating the quantity of the indicated technical features. Thus, the features defined with "first" and "second" may explicitly or implicitly include at least one such feature. In addition, the technical solutions between various embodiments can be combined with each other, but it must be based on the ability of those of ordinary skill in the art to implement. When the combination of technical solutions results in contradictions or cannot be implemented, it should be considered that such a combination of technical solutions does not exist and is not within the scope of protection required by the present application.
[0059] The embodiments of the present application provide a data acquisition circuit. Refer to Figure 1 , Figure 1 which is a connection schematic diagram provided for the first embodiment of the data acquisition circuit of the present application.
[0060] In this embodiment, the data acquisition circuit includes: a plurality of acquisition modules 10 and a main control module 20 including a network port sub-module 23, a first DSP sub-module 22, and a first CAN transceiver 21.
[0061] Both ends of the network port sub-module 23 are respectively connected to the host computer and the first end of the first DSP sub-module 22, and both ends of the first CAN transceiver 21 are respectively connected to the second end of the first DSP sub-module 22 and the acquisition module 10.
[0062] The acquisition module 10 is configured to convert the analog quantity data of a plurality of measurement points collected into CAN signals and transmit the CAN signals to the first CAN transceiver 21 of the main control module.
[0063] It should be noted that the acquisition module can convert continuously changing analog quantities (such as specific values of voltage, current, temperature, etc.) from multiple measurement points into a signal format that conforms to the CAN (Controller Area Network) communication protocol standard. This enables the transmission and interaction of these analog quantity data in the CAN network, facilitating the reception, processing, and analysis by the first CAN transceiver.
[0064] In a feasible implementation manner, referring to Figure 2 , Figure 2 is the overall functional block diagram of the circuit provided in the first embodiment of the data acquisition circuit of the present application. The acquisition module 10 in this embodiment includes: a second CAN transceiver, a second DSP sub-module, and an analog-to-digital acquisition sub-module; both ends of the analog-to-digital acquisition sub-module are respectively connected to the sensor and the first end of the second DSP sub-module, both ends of the second CAN transceiver are respectively connected to the second end of the second DSP sub-module and the CAN bus, and the first CAN transceiver and the second CAN transceiver are connected through the CAN bus; the analog-to-digital acquisition sub-module is used to perform analog-to-digital conversion on the analog quantity data transmitted by the sensor to obtain corresponding digital signals, and transmit the digital signals to the second DSP sub-module; the second DSP sub-module is used to modulate the digital signals to obtain CAN signals, and send the CAN signals to the second CAN transceiver; the second CAN transceiver is used to transmit the CAN signals to the first CAN transceiver through the CAN bus.
[0065] Exemplarily, as Figure 2 shown, the overall function of the data acquisition circuit consists of three parts, namely the upper computer software, the main control node (i.e., the main control module), and multiple acquisition nodes (i.e., acquisition modules) (such as Node 1, Node 2, Node 3, Node 4, etc.). The upper computer software realizes instruction issuance and data display, and is the control core of the entire acquisition system; the main control node, composed of a network interface (i.e., the network interface sub-module), a DSP (i.e., the first DSP sub-module), and a CAN transceiver (i.e., the above-mentioned first CAN transceiver), realizes the conversion between Ethernet and CAN communication, and is the bridge for communication between the upper computer and the acquisition nodes. The issuance of upper computer instructions and the upload of acquisition node data will pass through the main control node.
[0066] The acquisition node inputs data through the sensor, and is composed of an A / D acquisition module (i.e., the analog-to-digital acquisition sub-module), a DSP (i.e., the second DSP sub-module), and a CAN transceiver (i.e., the second CAN transceiver). Its main function is to perform high-precision acquisition on the analog quantity data and convert it into digital signals, and then transmit the data to the main control node through the CAN bus transmission system.
[0067] In another feasible implementation, refer to Figure 3 , Figure 3 which is the principle block diagram of the acquisition module provided in the first embodiment of the data acquisition circuit of the present application. The second DSP sub-module includes: a DSP chip and an electrically erasable programmable read-only memory; a first end of the DSP chip is connected to the analog-to-digital acquisition sub-module, a second end of the DSP chip is connected to the second CAN transceiver, and a third end of the DSP chip is connected to the electrically erasable programmable read-only memory.
[0068] Exemplarily, as Figure 3 shown, the acquisition node mainly includes a DSP chip (such as a TMS320F28335 chip), a CAN transceiver, an electrically erasable programmable read-only memory (for example, EEPROM), and an A / D acquisition module (wherein, A / D conversion can use an ADS1258 chip, including an internal 16-channel analog switch, a 24-bit ADC, and a digital filter). The acquisition node uses a modular design, and acquisition nodes can be added or reduced on the CAN bus according to the number of actual test points. When using the acquisition node, the CAN communication frame ID number and the node number need to be configured through UART. The main function of the acquisition node is to perform high-precision acquisition on the data transmitted by the sensor and the signal sensing circuit, convert it into a digital signal, and then transmit the data to the main control node through the CAN bus transmission system.
[0069] In another feasible implementation, refer to Figure 4 , Figure 4 which is the circuit design diagram of the analog-to-digital acquisition sub-module provided in the first embodiment of the data acquisition circuit of the present application. The analog-to-digital acquisition sub-module includes: an analog-to-digital conversion chip and a first crystal oscillator; an input end of the analog-to-digital conversion chip is connected to the sensor, an output end of the analog-to-digital conversion chip is connected to a first end of the DSP chip, a first clock end of the analog-to-digital conversion chip is connected to a first end of the first crystal oscillator, and a second clock end of the analog-to-digital conversion chip is connected to a second end of the first crystal oscillator.
[0070] As Figure 4 shown. The acquisition module can use an ADS1258 chip as the analog-to-digital conversion chip, and its high conversion accuracy makes the accuracy of the acquisition system relatively high. The main features of this A / D conversion chip are that it can be configured with 16 single-ended inputs or 8 differential inputs, and it can use either fixed channels or perform automatic channel scanning, with the highest frequencies being 125kHz and 23.7kHz respectively.
[0071] The ADS1258 circuit design is as Figure 4 and Figure 3As shown, the circuit pin CLKSEL is connected to a low level (i.e., GND), and the pins (such as XTSL1 and XTSL2) indicate that an external 32.768 kHz first crystal oscillator (X1) is used to generate the system clock; the DSP configures the internal registers of the ADS1258 and reads the data through the SPI bus, and the DSP can implement the chip selection and reset control of the A / D chip. The ADS1258 is configured as an automatic channel scanning mode to realize the acquisition of 16-channel analog data.
[0072] The above are only several feasible implementation manners of the acquisition module provided by this embodiment, and this embodiment does not make specific limitations on the specific implementation manners of the acquisition module.
[0073] The first CAN transceiver 21 is used to perform signal conversion on the CAN signal and transmit the converted differential signal to the first DSP sub-module 22.
[0074] It should be noted that the function of the first CAN transceiver is to further perform signal conversion processing on the above-mentioned converted CAN signal. It converts the CAN signal into a differential signal, and the differential signal is a way of transmitting signals using two signal lines, where the voltage difference between the two signal lines represents the actual information to be transmitted. This method has advantages such as strong anti-interference ability. Through such conversion, the signal can be transmitted and used in a form more suitable for the first DSP sub-module.
[0075] The first DSP sub-module 22 is used to perform data modulation on the differential signal and send the obtained first modulation signal to the network port sub-module 23.
[0076] It should be noted that the first DSP sub-module plays a role in processing and modulating the differential signal. The differential signal can be transformed according to certain rules to carry specific data information.
[0077] The network port sub-module 23 is used to perform protocol conversion on the modulation signal to obtain Ethernet data and upload the Ethernet data to the host computer.
[0078] It should be noted that Ethernet data refers to data that can be transmitted and exchanged in Ethernet.
[0079] In a feasible implementation manner, refer to Figure 5 , Figure 5This is the circuit principle block diagram of the network interface sub-module provided in the first embodiment of the data acquisition circuit of this application. In this embodiment, the network interface sub-module includes an Ethernet chip, a transformer, and a second crystal oscillator; the input end of the Ethernet chip is connected to the first end of the first DSP sub-module, the output end of the Ethernet chip is connected to the input end of the transformer, the output end of the transformer is connected to the host computer, and the clock end of the Ethernet chip is connected to the second crystal oscillator.
[0080] As Figure 5 shown, the network interface sub-module uses an Ethernet chip (such as LAN91C111) to implement Ethernet communication. This chip is a fast Ethernet controller designed specifically for embedded systems. This chip integrates the MAC layer and the PHY layer, supports transmission rates of 100Mbit / s and 10Mbit / s, supports full-duplex communication, and supports 16-bit and 32-bit parallel bus access.
[0081] The communication between the DSP and the LAN91C111 uses the method of 16-bit asynchronous communication. The data bus and address bus of the DSP are respectively connected to the data bus and address bus of the LAN91C111. It should be noted that A15 - A1 of the LAN91C111 is connected to the address line XA[15:1] of the DSP, and D15 - D0 of the LAN91C111 is connected to the data line XD[15:0] of the DSP. The reset signal of the LAN91C111 is controlled by connecting the GPIO of the DSP to the pin RESET, and the chip select signal AEN is provided by the XZCS7 pin of the DSP. The nRD and nWR signals of the LAN91C111 are respectively connected to the read and write control pins (such as XRD, WEO) of the DSP; the interrupt is controlled by connecting the INT pin of the DSP and the INTRO pin of the LAN91C111. The pin XTLP of the LAN91C111 requires an external clock of 25MHz, which is provided by a crystal oscillator (i.e., the second crystal oscillator). The transformer (such as YL18 - 20151S) is connected through the pins (such as TPI, TPO) of the LAN91C111.
[0082] In the technical solution provided in this embodiment, an analog-to-digital conversion chip ADS1258 with 16 channels and 24-bit high precision is selected to implement analog-to-digital conversion. Ethernet and CAN buses are used as communication methods, and a data acquisition circuit with high measurement accuracy, support for multiple nodes, and the ability to perform automated testing is designed.
[0083] Based on the first embodiment of the data acquisition circuit of this application, in the second embodiment of this application, for the same or similar content as the above-mentioned embodiment 1, reference can be made to the above introduction and will not be elaborated hereinafter. On this basis, please refer to Figure 6 , Figure 6 This is the circuit design diagram of CAN communication provided in the second embodiment of the data acquisition circuit of this application.
[0084] In this example, the DSP comes with an enhanced controller area network (eCAN) module. This module is externally connected to a CAN transceiver to enable CAN communication. The CAN communication module circuit based on DSP28335 is as Figure 6 shown. The TJA1050T can be used as the CAN transceiver. The CAN transceiver pins of the DSP are not directly connected to the CAN transceiver. Instead, a dual-channel digital isolator HCPL-9031 is used for electrical signal isolation (where the OUT1 pin of HCPL-9031 is connected to the TXD pin of TJA1050T, the IN2 pin of HCPL-9031 is connected to the RXD pin of TJA1050T, and the GND2 pin of HCPL-9031 is grounded to CAN-GND), to avoid the impact of the CAN bus on the DSP.
[0085] During design, to ensure the reliability and stability of CAN communication and prevent damage to the circuit caused by instantaneous large voltages, TVS diodes (such as TVS1, TVS2, TVS3, etc.) are added between the CANH, CANL, and CAN-GND pins of TJA1050T, as well as between CANL and CANH. The CANL and CANH signal lines need to use differential wiring to suppress common-mode interference. The capacitors C3 and C4 connected to the CAN bus are used to filter out high-frequency interference, and the parallel 120Ω termination resistor R4 is used to improve the anti-interference ability of communication.
[0086] As Figure 6 shown, the CANL pin is connected to the 2 end of TVS diode 2. The 1 end of TVS diode 2 is connected to the 1 end of TVS diode 1. The 1 end of TVS diode 1 is grounded, and the 2 end of TVS diode 1 is connected to the CANH pin. The CANL pin is connected to the 1 end of TVS diode 3, and the 2 end of TVS diode 3 is connected to the CANH pin. One end of capacitors C3 and C4 is connected to each other and grounded. The other end of capacitor C3 is connected to the CANL pin, and the other end of capacitor C4 is connected to the CANHL pin. The two ends of resistor R4 are respectively connected to the CANL pin and the CANH pin. The CANL pin is also connected to the CAN_N end, and the CANL pin is also connected to the CAN_P end. The CANL pin and the CANH pin are together connected to interface P1.
[0087] In the technical solution provided in this embodiment, through the circuit design diagram of CAN communication, the anti-interference ability of communication can be improved to enhance the reliability and stability of communication.
[0088] It should be noted that the above examples are only for understanding this application and do not constitute a limitation to the data acquisition circuit of this application. Based on this technical concept, more forms of simple transformations are within the protection scope of this application.
[0089] Based on the above data acquisition circuit, an embodiment of the present application provides a data acquisition control method. Refer to Figure 7 , Figure 7 which is a schematic diagram of the data conversion process provided in the first embodiment of the data acquisition control method of the present application. The data acquisition control method is applied to a data acquisition circuit, and the data acquisition circuit includes a plurality of acquisition modules and a main control module. The main control module is respectively connected to the acquisition module and the upper computer.
[0090] In this embodiment, for the part executed by the main control module, the method includes the steps of: after the data acquisition circuit is powered on and initialized, determining whether the received current data is Ethernet format data; if the current data is the Ethernet format data, performing UDP protocol detection on the current data; after the UDP protocol detection passes, parsing the current data to obtain command data and a CAN communication frame ID number; converting the command data into CAN command data, and transmitting the CAN command data to the corresponding acquisition module through the CAN communication frame ID number.
[0091] Based on the above data acquisition circuit, the conversion between Ethernet and CAN bus protocols is the core part of the communication of the acquisition system. Since the internal storage space of TMS320F28335 is limited, it is difficult to integrate all TCP / IP protocols. Therefore, code is written according to the system requirements, and only some functions of the TCP / IP protocol are implemented, including the IP protocol, ARP protocol, ICMP protocol, and UDP protocol. The conversion process of Ethernet data packets and CAN data packets is as Figure 7 shown.
[0092] As Figure 7 shown, after the data acquisition circuit starts to be powered on and initialized, first, the main control module determines whether the received current data is an Ethernet data packet (i.e., Ethernet format data); when the current data is Ethernet format data, UDP protocol detection is performed on the current data. (For example, whether it contains an IP packet, whether the destination address matches, and whether the UDP data packet port matches; if not, return to the initialization stage, if so, continue to the next step);
[0093] This process in the step of performing UDP protocol detection on the current data in this embodiment includes: extracting the address packet of the current data; determining whether the current data matches the destination address according to the address packet; when the current data matches the destination address, determining whether the current data matches the UDP port; if the current data matches the UDP port, it is determined that the UDP protocol detection of the current data passes.
[0094] After the above UDP protocol detection passes, parse the current data to obtain command data and the CAN communication frame ID number; convert the command data into CAN command data (i.e., encapsulate it into the CAN data format), and send the CAN command data to the corresponding acquisition module through the CAN bus via the CAN communication frame ID number.
[0095] In a feasible implementation manner, after the step of determining whether the received current data is Ethernet format data after the data acquisition circuit is powered on and initialized in this embodiment, the following is further included: If the current data is not the Ethernet format data, then determine whether the current data is CAN format data; when the current data is the CAN format data, then add a UDP data header, an address header, and an Ethernet frame header to the current data to generate Ethernet data, and upload the Ethernet data to the host computer.
[0096] As Figure 7 shown, if the current data is not Ethernet format data, then determine again whether the received data is a CAN data packet. If it is a CAN data packet, then take out the data and the CAN communication frame ID number from the CAN receive mailbox of the DSP, add a UDP data header, add an IP header, and add an Ethernet frame header; then determine whether UDP times out. If it does not time out, then determine whether the APR request bit is 1. If the APR request bit is 1 (if any of the above processes does not conform, then return to the initialization stage, if so, then continue to the next step), then encapsulate the transmission format into a data packet recognizable by the host computer, put the data packet into the UDP send buffer, and call the UDP send function, and the data packet will be automatically packed into a UDP data frame and sent to the host computer through the Ethernet.
[0097] It should be noted that during the above data transmission process, in order to enable the host computer to effectively complete instruction issuance and receive the data uploaded by the acquisition nodes, a communication protocol can be designed as follows:
[0098] 1. The command information sent by the master node to the acquisition nodes.
[0099] The specific command format sent by the master node to each acquisition node refers to Figure 8 , Figure 8This is a command format chart sent by the main control module to the acquisition module in the first embodiment of the data acquisition control method of this application. The node address (e.g., 1 to 110) and the channel address (e.g., 0 to 15) both occupy one byte, and the sampling rate occupies two bytes (e.g., 0 to 23739). If the sampling rate is configured to 0, the default sampling rate is used. The sampling frequencies can be configured with the following values: 1831, 6168, 15123, and 23739 Hz. After the acquisition node receives a frame of CAN data (8 bytes), the first 4 bytes are used for command parsing (the data in the last 4 bytes is invalid data), and then the corresponding address channel data is transmitted to the CAN bus.
[0100] 2. The data information responded by the acquisition node to the main control node.
[0101] The information format for the acquisition node to respond to the main control node refers to Figure 9 , Figure 9 This is a data format chart for the acquisition module of this application to respond to the main control module. The data includes the node address (occupying 1 byte, e.g., 1 to 110), the channel address (occupying 1 byte, e.g., 0 to 15), and the data after analog-to-digital conversion (occupying 3 bytes). After the main control node receives the response information, it can package the data and send it to the upper computer software.
[0102] 3. The data transmission format between the upper computer and the main control node.
[0103] Data is transmitted between the upper computer and the main control node using the UDP protocol over Ethernet. The data transmission format refers to Figure 10 , Figure 10 This is a data transmission format chart between the upper computer and the main control module of this application. Just add the frame header 0x55AA in front of the data transmission format (command information or data information) between the main control node and the acquisition node, the CAN frame ID number (occupying 4 bytes) in the middle, the data transmission between nodes occupies 4 or 5 bytes, and the frame tail 0x55BB is added at the end.
[0104] Further, in the above data transmission format, in this embodiment, for the part executed by the acquisition module, the method includes the steps of: when receiving the CAN command data sent by the main control module, collecting multiple measurement points to obtain analog quantity data; performing analog-to-digital conversion on the analog quantity data to obtain corresponding CAN signal data; uploading the CAN signal data to the main control module so that the main control module converts the CAN signal data into Ethernet data and uploads the Ethernet data to the upper computer.
[0105] In the technical solution provided in this embodiment, a high-precision A / D data acquisition circuit based on Ethernet and CAN bus is designed. The TMS320F28335 is selected as the main control chip for the main control node and the acquisition node. The LAN91C111 is used to implement Ethernet communication. The main control chip is externally connected to a CAN transceiver to implement the CAN communication function. The ADS1258 is used to implement multi-channel analog-to-digital conversion. The data transmission is reliable, the acquisition node can be flexibly expanded, and the acquisition accuracy is high.
[0106] Based on the first embodiment of the above data acquisition control method of the present application, in the second embodiment of the present application, the same or similar content as in the above-mentioned first embodiment can be referred to the above introduction and will not be repeated hereinafter.
[0107] On this basis, for the design of the acquisition process of the analog-to-digital acquisition sub-module in this embodiment, please refer to Figure 11 , Figure 11 which is the software flowchart of the analog-to-digital acquisition sub-module provided by the present application.
[0108] As Figure 11 shown, based on the above data acquisition circuit and the above data acquisition control method, when the analog-to-digital acquisition sub-module starts, first, the SPI interface and GPIO of the DSP are initialized. Then, the reset pin RESET of the ADS1258 chip is pulled low for 1 ms to reset the chip and reset the SPI bus and the SPI bus of the ADS1258. After that, the default value of the ADS1258 register can be set through the SPI interface of the DSP, and it is configured to 0, which is the automatic scan mode. Then, it is judged whether an instruction is received. If not, the step of judging whether an instruction is received is returned to execute; if an instruction is received, the register is configured. After configuring the ADS1258, the START pin is pulled high, and the ADS1258 will enter the data acquisition state. The DSP monitors whether the DRDY pin is low. If it is not low, it continues to monitor whether the DRDY pin is low; when it is low, the latest 4-byte data can be read. Note that the first byte is the status word, and the channel where the data is located can be known according to the status word. The 2nd to 4th bytes are the valid data of the A / D conversion. Finally, the data is packed and uploaded.
[0109] In the technical solution provided in this embodiment, through the above process of the analog-to-digital acquisition sub-module, the acquisition accuracy can be high.
[0110] It should be noted that the above examples are only for understanding the present application and do not constitute a limitation on the data acquisition control method of the present application. Based on this technical concept, more forms of simple transformations are within the protection scope of the present application.
[0111] To achieve the above object, the present application further provides a data acquisition system, which includes the data acquisition circuit as described above, and the data acquisition circuit is configured to implement the steps of the data acquisition control method as described above.
[0112] The data acquisition system provided by the present application can solve the technical problem of low test accuracy of traditional data acquisition systems. Compared with the prior art, the beneficial effects of the data acquisition system provided by the present application are the same as those of the data acquisition circuit and the data acquisition control method provided in the above embodiments, and will not be elaborated here.
[0113] The above are only partial embodiments of the present application, and thus do not limit the patent scope of the present application. Any equivalent structural transformation made under the technical concept of the present application by using the content of the specification and drawings of the present application, or any direct / indirect application in other related technical fields, is included in the patent protection scope of the present application.
Claims
1. A data acquisition circuit, characterized in that, The data acquisition circuit includes: a plurality of acquisition modules and a main control module including a network port sub-module, a first DSP sub-module, and a first CAN transceiver; Both ends of the network port sub-module are respectively connected to the host computer and the first end of the first DSP sub-module, and both ends of the first CAN transceiver are respectively connected to the second end of the first DSP sub-module and the acquisition module; The acquisition module is configured to convert the analog quantity data of multiple measurement points collected into CAN signals, and transmit the CAN signals to the first CAN transceiver of the main control module; The first CAN transceiver is configured to perform signal conversion on the CAN signals, and transmit the converted differential signals to the first DSP sub-module; The first DSP sub-module is configured to perform data modulation on the differential signals, and send the obtained first modulation signals to the network port sub-module; The network port sub-module is configured to perform protocol conversion on the modulation signals to obtain Ethernet data, and upload the Ethernet data to the host computer.
2. The circuit according to claim 1, wherein The acquisition module includes: a second CAN transceiver, a second DSP sub-module, and an analog-to-digital acquisition sub-module; Both ends of the analog-to-digital acquisition sub-module are respectively connected to the sensor and the first end of the second DSP sub-module, both ends of the second CAN transceiver are respectively connected to the second end of the second DSP sub-module and the CAN bus, and the first CAN transceiver and the second CAN transceiver are connected through the CAN bus; The analog-to-digital acquisition sub-module is configured to perform analog-to-digital conversion on the analog quantity data transmitted by the sensor to obtain corresponding digital signals, and transmit the digital signals to the second DSP sub-module; The second DSP sub-module is configured to perform data modulation on the digital signals to obtain CAN signals, and send the CAN signals to the second CAN transceiver; The second CAN transceiver is configured to transmit the CAN signals to the first CAN transceiver through the CAN bus.
3. The circuit according to claim 2, wherein, The second DSP sub-module includes: a DSP chip and an electrically erasable programmable read-only memory; The first end of the DSP chip is connected to the analog-to-digital acquisition sub-module, the second end of the DSP chip is connected to the second CAN transceiver, and the third end of the DSP chip is connected to the electrically erasable programmable read-only memory.
4. The circuit according to claim 3, wherein, The analog-to-digital acquisition sub-module includes: an analog-to-digital conversion chip and a first crystal oscillator; The input end of the analog-to-digital conversion chip is connected to the sensor, the output end of the analog-to-digital conversion chip is connected to the first end of the DSP chip, the first clock end of the analog-to-digital conversion chip is connected to the first end of the first crystal oscillator, and the second clock end of the analog-to-digital conversion chip is connected to the second end of the first crystal oscillator.
5. The circuit according to any one of claims 1 to 4, characterized in that The network port sub-module includes an Ethernet chip, a transformer, and a second crystal oscillator; The input end of the Ethernet chip is connected to the first end of the first DSP sub-module, the output end of the Ethernet chip is connected to the input end of the transformer, the output end of the transformer is connected to the host computer, and the clock end of the Ethernet chip is connected to the second crystal oscillator.
6. A data acquisition control method, characterized in that, The method is applied to a data acquisition circuit, which includes a plurality of acquisition modules and a main control module. The main control module is respectively connected to the acquisition modules and a host computer; The method is executed by the main control module, and the method includes: After the data acquisition circuit is powered on and initialized, determine whether the currently received data is Ethernet format data; If the currently received data is Ethernet format data, perform UDP protocol detection on the currently received data; After the UDP protocol detection passes, parse the currently received data to obtain command data and a CAN communication frame ID number; Convert the command data into CAN command data, and transmit the CAN command data to the corresponding acquisition module through the CAN communication frame ID number.
7. The method according to claim 6, characterized in that, The step of performing UDP protocol detection on the currently received data includes: Extract the address message of the currently received data; Determine whether the currently received data matches the destination address according to the address message; When the currently received data matches the destination address, determine whether the currently received data matches the UDP port; If the currently received data matches the UDP port, it is determined that the UDP protocol detection of the currently received data passes.
8. The method according to claim 6 or 7, characterized in that, After the step of determining whether the currently received data is Ethernet format data after the data acquisition circuit is powered on and initialized, the method further includes: If the currently received data is not Ethernet format data, determine whether the currently received data is CAN format data; When the currently received data is CAN format data, add a UDP data header, an address header, and an Ethernet frame header to the currently received data to generate Ethernet data, and upload the Ethernet data to the host computer.
9. A data acquisition control method, characterized in that, The method is applied to a data acquisition circuit, which includes a plurality of acquisition modules and a main control module. The main control module is respectively connected to the acquisition modules and a host computer; the method is executed by the acquisition module, and the method includes: When receiving the CAN command data sent by the main control module, collect multiple measurement points to obtain analog quantity data; Perform analog-to-digital conversion on the analog quantity data to obtain corresponding CAN signal data; Upload the CAN signal data to the main control module, so that the main control module converts the CAN signal data into Ethernet data and uploads the Ethernet data to the host computer.
10. A data acquisition system, characterized in that, The system includes the data acquisition circuit according to any one of claims 1 to 5, and the data acquisition circuit is configured to implement the steps of the data acquisition control method according to any one of claims 6 to 8 or claim 9.