Sampling circuit, sampling method, control chip and control equipment
Through the sampling circuit designed by the module, dynamically adjusting the analog-to-digital conversion channel sequence and comparing the module reference voltage, the problem of fixed traditional sampling methods is solved, and the sampling effect with higher adaptability and flexibility is achieved, meeting the real-time needs in motor control.
Patent Information
- Application Number
- CN202510566424.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-30
- Publication Date
- 2025-08-12
AI Technical Summary
The sampling method of traditional multi-channel ADC sampling circuit is fixed and cannot be flexibly adjusted according to real-time requirements, resulting in poor system performance or inability to meet real-time requirements.
The collaborative design of the analog-to-digital conversion module, comparison module and control module is adopted to dynamically adjust the sampling sequence of the analog-to-digital conversion channel and the reference voltage of the comparison module to achieve flexible configuration of sampling parameters.
It improves the adaptability and flexibility of the sampling circuit, can obtain better sampling results in different signal environments, reduce data inaccuracy and resource waste, and meet real-time needs.
Smart Images

Figure CN120474551A_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of motor control technology, and in particular relates to a sampling circuit, a sampling method, a control chip, and a control device. Background Art
[0002] An analog-to-digital converter (ADC) converts analog signals into digital signals for digital processing. However, the sampling method of traditional multi-channel ADC-based sampling circuits is fixed, making it impossible to flexibly adjust according to real-time requirements. Summary of the Invention
[0003] The embodiments of the present application provide a sampling circuit, a sampling method, a control chip, and a control device, which can solve the problem that traditional sampling circuits cannot be flexibly adjusted according to real-time needs.
[0004] In a first aspect, an embodiment of the present application provides a sampling circuit, comprising:
[0005] An analog-to-digital conversion module, the analog-to-digital conversion module including a plurality of analog-to-digital conversion channels, the plurality of analog-to-digital conversion channels being configured to sequentially perform sampling according to a first configuration parameter, each analog-to-digital conversion channel outputting a sampled signal after sampling; wherein the first configuration parameter is a sampling order of the plurality of analog-to-digital conversion channels;
[0006] a comparison module, the comparison module being electrically connected to each of the plurality of analog-to-digital conversion channels, the comparison module being configured to output a comparison signal based on a second configuration parameter and a sampling signal output by the corresponding analog-to-digital conversion channel; wherein the second configuration parameter is a reference voltage of the comparison module;
[0007] A control module is electrically connected to the comparison module and the analog-to-digital conversion module respectively, and is used to adjust the first configuration parameter and / or the second configuration parameter according to the comparison signal.
[0008] In a possible implementation of the first aspect, the comparison module includes a digital-to-analog conversion unit and at least one comparison unit, the digital-to-analog conversion unit includes a plurality of digital-to-analog conversion channels, the comparison units are electrically connected to the control module and corresponding digital-to-analog conversion channels, respectively, and the plurality of digital-to-analog conversion channels are electrically connected to the plurality of analog-to-digital conversion channels in a one-to-one correspondence;
[0009] When the comparison module includes a comparison unit, the control module is further used to identify the analog-to-digital conversion channel of the current output sampling signal and output a first parameter configuration instruction to the comparison unit; the digital-to-analog conversion channel corresponding to the current analog-to-digital conversion channel is used to convert the sampling signal output by the current analog-to-digital conversion channel and output a target signal to the comparison unit; the comparison unit is used to determine a second configuration parameter corresponding to the analog-to-digital conversion channel of the current output sampling signal based on the first parameter configuration instruction, and output a comparison signal based on the second configuration parameter and the target signal.
[0010] In a possible implementation of the first aspect, when the comparison module includes multiple comparison units, the control module is further used to identify the analog-to-digital conversion channel that currently outputs the sampling signal, and determine a target comparison unit among the multiple comparison units, and then output a second parameter configuration instruction to the target comparison unit; the digital-to-analog conversion channel corresponding to the current analog-to-digital conversion channel is used to convert the sampling signal output by the current analog-to-digital conversion channel, and output the target signal to the target comparison unit; the target comparison unit is used to determine the second configuration parameter corresponding to the analog-to-digital conversion channel that currently outputs the sampling signal according to the second parameter configuration instruction, and output a comparison signal based on the second configuration parameter and the target signal.
[0011] In a possible implementation of the first aspect, the comparison unit includes a comparator, a first input end of the comparator is electrically connected to the corresponding digital-to-analog conversion channel, a second input end of the comparator receives a reference voltage, and an output end of the comparator and a control end of the comparator are respectively electrically connected to the control module.
[0012] In a second aspect, an embodiment of the present application provides a sampling method, based on the sampling circuit described in any one of the first aspects, comprising:
[0013] The control module controls the multiple analog-to-digital conversion channels in the analog-to-digital conversion module to perform sampling in sequence according to the first configuration parameter, so that each analog-to-digital conversion channel outputs a sampled signal after sampling; wherein the first configuration parameter is the sampling order of the multiple analog-to-digital conversion channels;
[0014] The control module obtains a comparison signal; the comparison signal is a signal output by the comparison module according to a second configuration parameter and a sampling signal output by a corresponding analog-to-digital conversion channel; wherein the second configuration parameter is a reference voltage of the comparison module;
[0015] The control module adjusts the first configuration parameter and / or the second configuration parameter according to the comparison signal.
[0016] In a possible implementation of the second aspect, the control module adjusts the first configuration parameter and / or the second configuration parameter according to the comparison signal, including:
[0017] The comparison signal corresponding to the target analog-to-digital conversion channel is compared with a preset condition. If the comparison signal corresponding to the target analog-to-digital conversion channel does not meet the preset condition, it is determined whether the comparison signal corresponding to the next analog-to-digital conversion channel of the target analog-to-digital conversion channel meets the preset condition; wherein the target analog-to-digital conversion channel is any one of the multiple analog-to-digital conversion channels.
[0018] In a possible implementation of the second aspect, the control module adjusts the first configuration parameter and / or the second configuration parameter according to the comparison signal, further comprising:
[0019] If the comparison signals corresponding to each analog-to-digital conversion channel do not meet the preset conditions, a configuration parameter adjustment instruction is output to the comparison module, so that the comparison module adjusts the second configuration parameter according to the configuration parameter adjustment instruction, and determines whether the target comparison signal meets the preset conditions. If the target comparison signal does not meet the preset conditions, the configuration parameter adjustment instruction is output to the comparison module again until the target comparison signal meets the preset conditions or reaches a preset number of adjustments; wherein, the target comparison signal is a signal output by the comparison module based on the adjusted second configuration parameter and the sampling signal output by the corresponding analog-to-digital conversion channel.
[0020] In a possible implementation of the second aspect, the control module adjusts the first configuration parameter and / or the second configuration parameter according to the comparison signal, further comprising:
[0021] If the target comparison signal still does not meet the preset condition when the preset number of adjustments is reached, an interrupt is triggered.
[0022] In a third aspect, an embodiment of the present application provides a control chip comprising the sampling circuit described in any one of the first aspects.
[0023] In a fourth aspect, an embodiment of the present application provides a control device comprising the control chip described in the third aspect.
[0024] Compared with the prior art, the embodiments of the present application have the following beneficial effects:
[0025] An embodiment of the present application provides a sampling circuit, including an analog-to-digital conversion module, a comparison module and a control module. The analog-to-digital conversion module includes multiple analog-to-digital conversion channels, the comparison module is electrically connected to the multiple analog-to-digital conversion channels, and the control module is electrically connected to the comparison module and the multiple analog-to-digital conversion channels.
[0026] Multiple analog-to-digital conversion channels are configured to sequentially sample according to a first configuration parameter, with each analog-to-digital conversion channel sampling an input signal and outputting a sampled signal. The first configuration parameter is the sampling order of the multiple analog-to-digital conversion channels. A comparison module is configured to output a comparison signal based on a second configuration parameter and the sampled signals output by the corresponding analog-to-digital conversion channel. The second configuration parameter is a reference voltage for the comparison module. A control module is configured to adjust the first configuration parameter and / or the second configuration parameter based on the comparison signal.
[0027] The control module in the present application will analyze the comparison signal output by the comparison module to determine whether to adjust the first configuration parameter and / or the second configuration parameter. For example: if the comparison signal corresponding to a certain analog-to-digital conversion channel does not meet the preset conditions, the control module can adjust the order of the analog-to-digital conversion channels during the next sampling, so as to avoid wasting too much sampling time on channels that do not meet the conditions and concentrate resources on channels that are more important or more likely to meet the conditions. Or when the comparison signal does not meet the preset conditions due to inappropriate setting of the second configuration parameter, the control module can send an instruction to the comparison module to change the second configuration parameter to better adapt to changes in the input signal and ensure that the comparison signal can more accurately reflect whether the input signal meets the preset conditions. Through this dynamic adjustment mechanism, the sampling circuit of the present application can optimize the sampling process in real time according to actual conditions, so that it can better adapt to real-time changes in the input signal and different application requirements.
[0028] Compared with traditional sampling circuits with fixed sampling orders, the sampling circuit of the present application has higher adaptability and flexibility, can obtain better sampling effects in various signal environments, better meet real-time needs, and reduce problems such as inaccurate data or waste of resources caused by unreasonable sampling settings.
[0029] In summary, the present application realizes dynamic adjustment of the first configuration parameter and the second configuration parameter through the synergy between modules, overcoming the limitation of the fixed sampling mode of the traditional multi-channel ADC sampling circuit.
[0030] It can be understood that the beneficial effects of the second to fourth aspects 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
[0031] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following briefly introduces the drawings required for use in the embodiments or descriptions of the prior art. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0032] Figure 1 This is a principle block diagram of a sampling circuit provided in one embodiment of the present application;
[0033] Figure 2 is a principle block diagram of a sampling circuit provided in another embodiment of the present application;
[0034] Figure 3 is a principle block diagram of a sampling circuit provided in another embodiment of the present application;
[0035] Figure 4 1 is a circuit connection diagram of a comparison unit provided in one embodiment of the present application;
[0036] Figure 5 This is a flowchart of a sampling method provided in one embodiment of the present application.
[0037] In the figure: 10, analog-to-digital conversion module; 11, analog-to-digital conversion channel; 20, comparison module; 21, comparison unit; 22, digital-to-analog conversion unit; 221, digital-to-analog conversion channel; 30, control module. DETAILED DESCRIPTION
[0038] In the following description, specific details such as specific system structures and techniques are provided for purposes of illustration rather than limitation to facilitate a thorough understanding of the embodiments of the present application. However, it will be apparent to those skilled in the art that the present application may be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to avoid obscuring the description of the present application with unnecessary detail.
[0039] It should be understood that when used in the present specification and the appended claims, the term "comprising" indicates the presence of described features, integers, steps, operations, elements and / or components, but does not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or collections thereof.
[0040] It will also be understood that the term "and / or" used in this specification and the appended claims refers to and includes any and all possible combinations of one or more of the associated listed items.
[0041] As used in this specification and the appended claims, the term "if" can be interpreted as "when" or "upon" or "in response to determining" or "in response to detecting," depending on the context. Similarly, the phrase "if it is determined" or "if [described condition or event] is detected" can be interpreted as meaning "upon determination" or "in response to determining" or "upon detection of [described condition or event]" or "in response to detecting [described condition or event]," depending on the context.
[0042] In addition, in the description of the present application specification and the appended claims, the terms "first", "second", "third", etc. are only used to distinguish the descriptions and cannot be understood as indicating or implying relative importance.
[0043] References to "one embodiment" or "some embodiments" in this specification mean that a particular feature, structure, or characteristic described in conjunction with that embodiment is included in one or more embodiments of the present application. Thus, phrases such as "in one embodiment," "in some embodiments," "in other embodiments," and "in other embodiments" appearing in various places in this specification do not necessarily refer to the same embodiment, but rather mean "one or more but not all embodiments," unless otherwise specifically emphasized. The terms "including," "comprising," "having," and variations thereof all mean "including but not limited to," unless otherwise specifically emphasized.
[0044] ADCs are widely used to convert analog signals (such as voltage, current, and position) generated during motor operation into digital signals for digital processing and control by electronic devices. However, traditional sampling circuits based on multi-channel ADCs often employ a fixed sampling method (e.g., the sampling order of multi-channel ADCs is fixed), making them inflexible based on actual application requirements. For example, in motor control, different control algorithms and application scenarios may require different sampling orders, and a fixed sampling method can result in suboptimal system performance or, in some cases, fail to meet real-time requirements.
[0045] In order to solve the above problems, the present invention provides a sampling circuit. Figure 1 As shown, the sampling circuit includes an analog-to-digital conversion module 10, a comparison module 20 and a control module 30. The analog-to-digital conversion module 10 includes multiple analog-to-digital conversion channels. The comparison module 20 is electrically connected to the multiple analog-to-digital conversion channels 11 respectively. The control module 30 is electrically connected to the comparison module 20 and the analog-to-digital conversion module 10 respectively.
[0046] Specifically, multiple analog-to-digital conversion channels 11 are configured to sequentially sample according to a first configuration parameter. Each analog-to-digital conversion channel 11 samples a corresponding input signal and outputs a sampled signal. The input signal is the sampled analog signal, which can be various physical quantities, such as current, voltage, temperature, pressure, position, etc. The first configuration parameter is the sampling order of the multiple analog-to-digital conversion channels 11, which is configured and adjusted by the control module 30. The comparison module 20 is configured to output a comparison signal based on a second configuration parameter and the sampled signal output by the corresponding analog-to-digital conversion channel 11. The second configuration parameter is the reference voltage of the comparison module 20, which is configured and adjusted by the control module 30. It should be noted that the comparison module 20 first converts the sampled signal to obtain a sampled analog signal, then compares the sampled analog signal with the reference voltage and outputs a comparison signal. The comparison signal is a logic level signal, such as a high or low level. The control module 30 is configured to adjust the first and / or second configuration parameters based on the comparison signal.
[0047] The control module 30 in the present application will analyze the comparison signal output by the comparison module 20 to determine whether to adjust the first configuration parameter and / or the second configuration parameter. For example: if the comparison signal corresponding to a certain analog-to-digital conversion channel 11 does not meet the preset conditions, the control module 30 can adjust the order of the analog-to-digital conversion channels 11 during the next sampling, so as to avoid wasting too much sampling time on channels that do not meet the conditions and concentrate resources on more important or more likely to meet the conditions. Specifically, assuming that a certain analog-to-digital conversion channel 11 collects a weak signal and the signal is temporarily out of the expected range, the control module 30 can delay the sampling order of the channel, first sample other channels that may provide valid information, and then sample the channel when subsequent conditions are met.
[0048] Or when the comparison signal does not meet the preset conditions due to inappropriate setting of the second configuration parameter, the control module 30 can send an instruction to the comparison module 20 to change the second configuration parameter to better adapt to the changes in the input signal and ensure that the comparison signal can more accurately reflect whether the input signal meets the preset conditions. Specifically, in a system monitoring a signal amplitude variation range with a large range, if the initially set reference voltage causes most input signals to fail to meet the preset conditions, the control module 30 can appropriately increase or decrease the reference voltage of the comparison module 20 according to the comparison signal. If it is found that most input signals are greater than the current reference voltage, the control module 30 can increase the reference voltage, otherwise it can decrease the reference voltage to better adapt to the changes in the input signal and ensure that the comparison signal can more accurately reflect whether the input signal meets the preset conditions. Through this dynamic adjustment mechanism, the sampling circuit of the present application can optimize the sampling process in real time according to actual conditions, making it more adaptable to real-time changes in input signals and different application requirements.
[0049] Compared with traditional sampling circuits with fixed sampling orders, the sampling circuit of the present application has higher adaptability and flexibility, can obtain better sampling effects in various signal environments, better meet real-time needs, and reduce problems such as inaccurate data or waste of resources caused by unreasonable sampling settings.
[0050] In summary, the present application realizes dynamic adjustment of the first configuration parameter and the second configuration parameter through the synergy between modules, overcoming the limitation of the fixed sampling mode of the traditional multi-channel ADC sampling circuit.
[0051] It should be noted that before the sampling circuit initiates sampling, the control module 30 configures the first and second configuration parameters. Furthermore, the control module 30 configures the sampling time and resolution for each analog-to-digital conversion channel 11, ensuring that each channel 11 has an independent sampling time and resolution to accommodate different signal characteristics and conversion accuracy requirements. Specifically, in motor control, it is necessary to sample the three-phase voltages so that the motor can be controlled based on the variations in the three-phase voltages. For phase voltages with higher frequencies, a shorter sampling time is required to accurately capture their information to prevent errors caused by frequency variations during the sampling process. If the sampling time is too long, multiple cycles of the signal may be sampled, resulting in the sampling result not accurately reflecting the instantaneous value of the phase voltage. For phase voltages with lower frequencies, appropriately extending the sampling time can obtain a more accurate average value or effective value, thereby improving measurement accuracy. In some high-precision motor control applications, such as servo motor control, a higher resolution may be required to accurately measure small variations in the three-phase voltages to achieve precise speed and position control. In some application scenarios where precision is not a high requirement, such as ordinary asynchronous motor speed control, a lower resolution can be used to reduce data processing volume and cost.
[0052] Exemplarily, the control module 30 includes a microcontroller. The present application does not limit the specific type of the microcontroller, as long as it can realize the functions of the control module 30.
[0053] It should be noted that each analog-to-digital conversion channel 11 corresponds to an analog input pin, through which external analog signal sources, such as sensors, voltage sources, motors, etc., can be connected.
[0054] After explaining the core architecture of the sampling circuit, including the basic functions and interconnection relationships of each module, and the basic principle of how the control module 30 dynamically adjusts the first configuration parameter and the second configuration parameter according to the comparison signal, Figure 2 The specific structure of the comparison module 20 is shown as follows: Figure 2As shown, the comparison module 20 includes a digital-to-analog conversion unit 22 and at least one comparison unit 21. The digital-to-analog conversion unit 22 includes multiple digital-to-analog conversion channels 221. The comparison unit 21 is electrically connected to the control module 30 and the corresponding digital-to-analog conversion channels 221 respectively. The multiple digital-to-analog conversion channels 221 are electrically connected to the multiple analog-to-digital conversion channels 11 in a one-to-one correspondence.
[0055] Specifically, such as Figure 2 As shown, when the comparison module 20 includes a comparison unit 21, the control module 30 is further configured to identify the analog-to-digital conversion channel 11 currently outputting the sampled signal and output a first parameter configuration instruction to the comparison unit 21. The digital-to-analog conversion channel 221 corresponding to the current analog-to-digital conversion channel 11 is configured to convert the sampled signal output by the current analog-to-digital conversion channel 11 and output a target signal to the comparison unit 21. The target signal is the sampled analog signal, i.e., the input signal. The comparison unit 21 is configured to determine a second configuration parameter corresponding to the analog-to-digital conversion channel 11 currently outputting the sampled signal based on the first parameter configuration instruction and output a comparison signal based on the second configuration parameter and the target signal.
[0056] Because the comparison module 20 includes only one comparison unit 21, the comparison operation of multiple sampled analog signals can be performed by properly utilizing this comparison unit 21, effectively conserving the resources of the comparison unit 21. Compared to equipping each analog-to-digital conversion channel 11 with a separate comparison unit 21, this design reduces hardware resource usage, circuit complexity, and cost. For example, in a multi-channel data acquisition system, if multiple analog-to-digital conversion channels 11 require comparison operations, using only one comparison unit 21 can avoid the problems of increased chip area and power consumption caused by a large number of comparison units 21. This is particularly important for systems with limited resources (such as embedded systems or some cost-sensitive applications).
[0057] The multiple analog-to-digital conversion channels 11 perform sampling according to the sampling order set by the control module 30, and the comparison unit 21 can sequentially receive the sampled analog signals according to this order. This makes the entire sampling and comparison process have a certain degree of order, which facilitates the orderly management and scheduling of the entire process by the control module 30. For example, in a complex signal acquisition scenario, it may be necessary to sample and compare different analog signals according to a certain priority or logical order. This sequentiality can ensure that data processing is carried out according to the predetermined logical order, thereby improving the reliability and predictability of the system.
[0058] The control module 30 outputs a first parameter configuration instruction to the comparison unit 21, so that the comparison unit 21 can dynamically determine the corresponding second configuration parameter according to different analog-to-digital conversion channels 11. This means that the comparison unit 21 can flexibly adjust its comparison reference standard according to the signal characteristics of different channels and the current sampling requirements. For example: in an environmental monitoring system, the signal range and characteristics of different sensors may be different. When the analog-to-digital conversion channel 11 samples different sensors, the control module 30 can send different first parameter configuration instructions based on the sensor type or previous sampling results, so that the comparison unit 21 sets a suitable reference voltage for different sensor signals, thereby achieving effective comparison and monitoring of different sensor signals. This ensures that the comparison signal output by the comparison unit 21 more accurately reflects whether the input signals of different channels meet the corresponding preset conditions, avoids the problem of inaccurate comparison results that may result from using a fixed reference voltage, and improves the system's adaptability to different input signals.
[0059] like Figure 3 As shown, when the comparison module 20 includes multiple comparison units 21, Figure 3 Where m represents the number of comparison units 21, and n represents the number of analog-to-digital conversion channels 11, where m≤n. The control module 30 is further configured to identify the analog-to-digital conversion channel 11 currently outputting the sampled signal, determine a target comparison unit among the multiple comparison units 21, and then output a second parameter configuration instruction to the target comparison unit. The digital-to-analog conversion channel 221 corresponding to the current analog-to-digital conversion channel 11 is configured to convert the sampled signal output by the current analog-to-digital conversion channel 11 and output a target signal to the target comparison unit. The target signal is the sampled analog signal, i.e., the input signal. The target comparison unit determines the second configuration parameter corresponding to the analog-to-digital conversion channel 11 currently outputting the sampled signal based on the second parameter configuration instruction, and outputs a comparison signal based on the second configuration parameter and the target signal.
[0060] Specifically, when the comparison module 20 includes multiple comparison units 21, different comparison units 21 can process signals from different analog-to-digital conversion channels 11 in parallel, which greatly improves the processing speed of the system. When only one comparison unit 21 is used, the signals of multiple analog-to-digital conversion channels 11 need to be processed sequentially, which may introduce delays, especially in scenarios with high sampling frequencies or multi-channel signals that need to be processed quickly. Multiple comparison units 21 can perform comparison operations on multiple signals at the same time, thereby reducing processing time and improving the real-time performance of the system. For example: in high-speed data acquisition systems, such as radar signal processing, high-speed communication systems, etc., a large amount of sampled data needs to be processed in a short time. Multiple comparison units 21 can process signals from multiple channels in parallel, avoiding data backlogs and delays caused by sequential processing, and ensuring that the system can respond quickly and process large amounts of high-speed data.
[0061] Each comparison unit 21 can independently determine its corresponding second configuration parameter according to the second parameter configuration instruction, which allows different analog-to-digital conversion channels 11 to have more personalized comparison settings without the need to frequently switch configurations to adapt to the signal characteristics of different channels like a single comparison unit 21.
[0062] Because multiple comparison units 21 can operate independently, even if one comparison unit 21 fails, the remaining comparison units 21 can continue to operate normally, preventing the entire comparison module 20 from failing, thereby improving the overall reliability of the system. In applications requiring high system reliability, such as aerospace and medical equipment monitoring, this redundant design ensures that even if some components fail, the system can continue to collect and compare some data, buying time for subsequent fault diagnosis and maintenance.
[0063] For example, Figure 4 As shown, the comparison unit 21 includes a comparator CMP, a first input terminal of the comparator CMP is electrically connected to the corresponding digital-to-analog conversion channel 221, a second input terminal of the comparator CMP receives a reference voltage VREF, and an output terminal of the comparator CMP and a control terminal of the comparator CMP are electrically connected to the control module 30 respectively.
[0064] Specifically, comparator CMP plays a key role in the entire sampling circuit. It compares the sampled analog signal with reference voltage VREF and transmits the comparison result as a high or low level to control module 30. This provides control module 30 with a basis for determining whether the sampled analog signal meets preset conditions, thereby dynamically adjusting and controlling the entire system.
[0065] In summary, the present application realizes dynamic adjustment of the first configuration parameter and the second configuration parameter through the synergy between modules, so that the sampling circuit of the present application can better adapt to the real-time changes of the input signal and different application requirements, overcoming the limitations of the fixed sampling method of the traditional multi-channel ADC sampling circuit.
[0066] The embodiment of the present application also provides a sampling method based on the above sampling circuit, such as Figure 5 As shown, the sampling method includes steps S501 to S503.
[0067] S501. A control module controls multiple analog-to-digital conversion channels in an analog-to-digital conversion module to perform sampling in sequence according to a first configuration parameter, so that each analog-to-digital conversion channel outputs a sampling signal after sampling; wherein the first configuration parameter is the sampling order of the multiple analog-to-digital conversion channels.
[0068] Specifically, the control module configures the first configuration parameter to determine a sampling order for the multiple analog-to-digital conversion channels. The sampling order can be pre-set or dynamically adjusted based on a comparison result. The control module sends a sampling instruction to each analog-to-digital conversion channel in the analog-to-digital conversion module based on the first configuration parameter, thereby initiating a sampling process.
[0069] The analog-to-digital conversion module contains multiple analog-to-digital conversion channels, each responsible for sampling its corresponding input signal. When a sampling instruction from the control module reaches a channel, that channel samples the corresponding input signal and converts it into a digital signal, known as the sampled signal.
[0070] Assume there are three analog-to-digital conversion channels, A, B, and C, which are used to measure current, voltage, and temperature, respectively. The first configuration parameter sets the sampling order as A, B, and C. First, the control module sends a sampling instruction to channel A, causing channel A to sample the current analog signal and output the sampled signal. Then, the control module sends a sampling instruction to channel B, causing channel B to sample the voltage analog signal and output the sampled signal. Finally, the control module sends a sampling instruction to channel C, causing channel C to sample the temperature analog signal and output the sampled signal.
[0071] S502, the control module obtains a comparison signal; the comparison signal is a signal output by the comparison module according to the second configuration parameter and the sampling signal output by the corresponding analog-to-digital conversion channel; wherein the second configuration parameter is a reference voltage of the comparison module.
[0072] Specifically, after receiving the sampling signal output by the analog-to-digital conversion channel, the comparison module converts the sampling signal to obtain a sampled analog signal, then compares the sampled analog signal with the second configuration parameter and outputs a comparison signal. The comparison signal is a logic level signal (such as a high level or a low level). The control module obtains the comparison signal output by the comparison module. This is because the comparison signal contains information about the sampled analog signal. The control module can dynamically adjust the first configuration parameter and / or the second configuration parameter based on this information.
[0073] S503: The control module adjusts the first configuration parameter and / or the second configuration parameter according to the comparison signal.
[0074] Specifically, after receiving the comparison signal, the control module will determine whether the comparison signal meets the preset conditions. If the comparison signal does not meet the preset conditions, the control module will adjust the first configuration parameter and / or the second configuration parameter so that the sampling circuit can better adapt to different signal characteristics and application requirements, thereby improving the accuracy and efficiency of sampling. For example: if the comparison signal corresponding to a certain analog-to-digital conversion channel does not meet the preset conditions, the control module can adjust the order of the analog-to-digital conversion channels during the next sampling, so as to avoid wasting too much sampling time on channels that do not meet the conditions and concentrate resources on channels that are more important or more likely to meet the conditions. Specifically, assuming that a certain analog-to-digital conversion channel collects a weak signal and the signal is temporarily out of the expected range, the control module can delay the sampling order of the channel, first sample other channels that may provide valid information, and then sample the channel when subsequent conditions are met.
[0075] Alternatively, when the comparison signal does not meet the preset conditions due to an inappropriate setting of the second configuration parameter, the control module can send an instruction to the comparison module to change the second configuration parameter to better adapt to changes in the input signal and ensure that the comparison signal can more accurately reflect whether the input signal meets the preset conditions. Specifically, in a system monitoring a signal with a large amplitude variation range, if the initially set reference voltage causes most input signals to fail to meet the preset conditions, the control module can appropriately increase or decrease the reference voltage of the comparison module based on the comparison signal. If it is found that most input signals are greater than the current reference voltage, the control module can increase the reference voltage, otherwise it can decrease the reference voltage to better adapt to changes in the input signal and ensure that the comparison signal can more accurately reflect whether the input signal meets the preset conditions.
[0076] In summary, the sampling method provided in the embodiment of the present application realizes dynamic adjustment of the first configuration parameter and the second configuration parameter through the coordinated control of the analog-to-digital conversion module and the comparison module by the control module. This dynamic adjustment mechanism can optimize the sampling process in real time according to actual conditions, making it more adaptable to real-time changes in the input signal and different application requirements.
[0077] In some embodiments, step S503 includes: comparing the comparison signal corresponding to the target analog-to-digital conversion channel with a preset condition; if the comparison signal corresponding to the target analog-to-digital conversion channel does not meet the preset condition, determining whether the comparison signal corresponding to the next analog-to-digital conversion channel of the target analog-to-digital conversion channel meets the preset condition; wherein the target analog-to-digital conversion channel is any one of the multiple analog-to-digital conversion channels.
[0078] Specifically, the control module obtains the comparison signal corresponding to the target analog-to-digital conversion channel. The comparison signal reflects the comparison result between the analog signal collected by the target analog-to-digital conversion channel and the reference voltage. The control module compares the comparison signal with the preset conditions. For example, the preset conditions stipulate that the comparison signal should be a low level, and the control module obtains a high level comparison signal corresponding to the target analog-to-digital conversion channel, then it indicates that the comparison signal does not meet the preset conditions. If the preset conditions are not met, the comparison signal corresponding to the next analog-to-digital conversion channel is judged. The control module obtains the comparison signal corresponding to the next analog-to-digital conversion channel, and compares it with the preset conditions to determine whether the comparison signal of the channel meets the preset conditions.
[0079] For example: Assume that the analog-to-digital conversion module has an analog-to-digital conversion channel CH0-CH19, the analog-to-digital conversion channel CH0 is the target conversion channel, and the preset condition is a low level. When the comparison signal corresponding to the analog-to-digital conversion channel CH0 is a high level, it means that it does not meet the preset condition. The control module switches the channel of the analog-to-digital conversion module to the analog-to-digital conversion channel CH1. If the comparison signal corresponding to the analog-to-digital conversion channel CH1 is still a high level, the control module switches the channel of the analog-to-digital conversion module to the analog-to-digital conversion channel CH2, and so on, until the comparison signal corresponding to the next channel meets the preset condition.
[0080] In some embodiments, step S503 further includes: if the comparison signal corresponding to each analog-to-digital conversion channel does not meet the preset condition, outputting a configuration parameter adjustment instruction to the comparison module, causing the comparison module to adjust the second configuration parameter according to the configuration parameter adjustment instruction, and determining whether the target comparison signal meets the preset condition; if the target comparison signal does not meet the preset condition, outputting the configuration parameter adjustment instruction to the comparison module again until the target comparison signal meets the preset condition or reaches a preset number of adjustments, where the preset number of adjustments is manually set. The target comparison signal is a signal output by the comparison module based on the adjusted second configuration parameter and the sampled signal output by the corresponding analog-to-digital conversion channel.
[0081] Specifically, when the comparison signals corresponding to all analog-to-digital conversion channels do not meet the preset conditions, a configuration parameter adjustment instruction will be sent to the comparison module, causing the comparison module to adjust the second configuration parameter. The comparison module will output a target comparison signal based on the adjusted second configuration parameter and the sampling signal output by the corresponding analog-to-digital conversion channel. After the control module obtains the target comparison signal, it will compare it with the preset conditions again to determine whether the preset conditions are met. If so, it means that the adjusted parameter setting is valid, and the system can continue to sample and compare according to the new parameters; if it still does not meet the requirements, the second configuration parameter will be adjusted again until the target comparison signal meets the preset conditions or the preset number of adjustments is reached.
[0082] For example: the second configuration parameter corresponding to a certain analog-to-digital conversion channel is 1V. When the comparison signals corresponding to all analog-to-digital conversion channels do not meet the preset conditions, the control module will output a configuration parameter adjustment instruction to the comparison module: used to adjust the second configuration parameter to 2V. The comparison module will compare the adjusted second configuration parameter with the analog signal corresponding to the analog-to-digital conversion channel to obtain a target comparison signal. Assuming that the preset condition is a low level and the target comparison signal is a high level, it means that the target comparison signal does not meet the preset condition. Then, the configuration parameter adjustment instruction is output to the comparison module again: used to adjust the second configuration parameter to 3V, and then determine again whether the target comparison signal meets the preset condition. If the target comparison signal does not meet the preset condition, the configuration parameter adjustment instruction is output to the comparison module again; used to adjust the second configuration parameter to 4V, and so on, until the target comparison signal meets the preset condition or the preset number of adjustments is reached.
[0083] In some embodiments, step S503 further includes: if the target comparison signal still does not meet the preset condition when the preset number of adjustments is reached, triggering an interrupt.
[0084] Specifically, if the target comparison signal still fails to meet the preset conditions after reaching the preset number of adjustments, this indicates a possible system anomaly, such as sensor failure, circuit interference, or incorrect parameter settings. Triggering an interrupt allows the system to promptly suspend normal operations, preventing the abnormal situation from worsening and causing more serious damage to the system. For example, on an industrial automation production line, if an abnormal motor current is detected, triggering an interrupt can immediately stop the motor, preventing it from burning out due to overcurrent and ensuring the safety of equipment and personnel.
[0085] In summary, the sampling method provided in the embodiment of the present application realizes dynamic adjustment of the first configuration parameter and the second configuration parameter through the coordinated control of the analog-to-digital conversion module and the comparison module by the control module. This dynamic adjustment mechanism can optimize the sampling process in real time according to actual conditions, making it more adaptable to real-time changes in the input signal and different application requirements.
[0086] The present application also provides a control chip including the aforementioned sampling circuit. Since the control chip provided by the present application includes the aforementioned sampling circuit, the control chip can change the sampling mode of the sampling circuit according to the application scenario in motor control to ensure optimal system performance or, in some cases, meet real-time requirements.
[0087] The present application also provides a control device including the aforementioned control chip. Since the control device provided in the present application includes the aforementioned control chip, the control device can adjust the sampling method according to the actual application scenario to optimize the system or, in some cases, meet real-time requirements.
[0088] Exemplarily, the control device is a motor control device.
[0089] In the above embodiments, the description of each embodiment has its own focus. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant description of other embodiments.
[0090] The above-described embodiments 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, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. These modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the various embodiments of the present application, and should all be included in the scope of protection of the present application.
Claims
1. A sampling circuit, characterized in that: include: An analog-to-digital conversion module, the analog-to-digital conversion module including a plurality of analog-to-digital conversion channels, the plurality of analog-to-digital conversion channels being configured to sequentially perform sampling according to a first configuration parameter, each analog-to-digital conversion channel outputting a sampled signal after sampling; wherein the first configuration parameter is a sampling order of the plurality of analog-to-digital conversion channels; a comparison module, the comparison module being electrically connected to each of the plurality of analog-to-digital conversion channels, the comparison module being configured to output a comparison signal based on a second configuration parameter and a sampling signal output by the corresponding analog-to-digital conversion channel; wherein the second configuration parameter is a reference voltage of the comparison module; A control module is electrically connected to the comparison module and the analog-to-digital conversion module respectively, and is used to adjust the first configuration parameter and / or the second configuration parameter according to the comparison signal.
2. The sampling circuit according to claim 1, wherein: The comparison module includes a digital-to-analog conversion unit and at least one comparison unit, the digital-to-analog conversion unit includes a plurality of digital-to-analog conversion channels, the comparison units are electrically connected to the control module and the corresponding digital-to-analog conversion channels respectively, and the plurality of digital-to-analog conversion channels are electrically connected to the plurality of analog-to-digital conversion channels in a one-to-one correspondence; When the comparison module includes a comparison unit, the control module is further configured to identify the analog-to-digital conversion channel currently outputting the sampling signal and output a first parameter configuration instruction to the comparison unit; the digital-to-analog conversion channel corresponding to the current analog-to-digital conversion channel is configured to convert the sampling signal output by the current analog-to-digital conversion channel and output a target signal to the comparison unit; The comparison unit is configured to determine a second configuration parameter corresponding to the analog-to-digital conversion channel currently outputting the sampling signal according to the first parameter configuration instruction, and output a comparison signal according to the second configuration parameter and the target signal.
3. The sampling circuit according to claim 2, wherein: When the comparison module includes multiple comparison units, the control module is further used to identify the analog-to-digital conversion channel that currently outputs the sampling signal, and determine a target comparison unit among the multiple comparison units, and then output a second parameter configuration instruction to the target comparison unit; the digital-to-analog conversion channel corresponding to the current analog-to-digital conversion channel is used to convert the sampling signal output by the current analog-to-digital conversion channel, and output the target signal to the target comparison unit; the target comparison unit is used to determine the second configuration parameter corresponding to the analog-to-digital conversion channel that currently outputs the sampling signal according to the second parameter configuration instruction, and output a comparison signal according to the second configuration parameter and the target signal.
4. The sampling circuit according to claim 2 or 3, characterized in that: The comparison unit includes a comparator, a first input end of the comparator is electrically connected to the corresponding digital-to-analog conversion channel, a second input end of the comparator receives a reference voltage, and an output end of the comparator and a control end of the comparator are electrically connected to the control module respectively.
5. A sampling method, based on the sampling circuit according to any one of claims 1 to 4, characterized in that: include: The control module controls the multiple analog-to-digital conversion channels in the analog-to-digital conversion module to perform sampling in sequence according to the first configuration parameter, so that each analog-to-digital conversion channel outputs a sampled signal after sampling; wherein the first configuration parameter is the sampling order of the multiple analog-to-digital conversion channels; The control module obtains a comparison signal; the comparison signal is a signal output by the comparison module according to a second configuration parameter and a sampling signal output by a corresponding analog-to-digital conversion channel; wherein the second configuration parameter is a reference voltage of the comparison module; The control module adjusts the first configuration parameter and / or the second configuration parameter according to the comparison signal.
6. The sampling method according to claim 5, characterized in that: The control module adjusts the first configuration parameter and / or the second configuration parameter according to the comparison signal, including: The comparison signal corresponding to the target analog-to-digital conversion channel is compared with a preset condition. If the comparison signal corresponding to the target analog-to-digital conversion channel does not meet the preset condition, it is determined whether the comparison signal corresponding to the next analog-to-digital conversion channel of the target analog-to-digital conversion channel meets the preset condition; wherein the target analog-to-digital conversion channel is any one of the multiple analog-to-digital conversion channels.
7. The sampling method according to claim 6, characterized in that: The control module adjusts the first configuration parameter and / or the second configuration parameter according to the comparison signal, further comprising: If the comparison signals corresponding to each analog-to-digital conversion channel do not meet the preset conditions, a configuration parameter adjustment instruction is output to the comparison module, so that the comparison module adjusts the second configuration parameter according to the configuration parameter adjustment instruction, and determines whether the target comparison signal meets the preset conditions. If the target comparison signal does not meet the preset conditions, the configuration parameter adjustment instruction is output to the comparison module again until the target comparison signal meets the preset conditions or reaches a preset number of adjustments; wherein, the target comparison signal is a signal output by the comparison module based on the adjusted second configuration parameter and the sampling signal output by the corresponding analog-to-digital conversion channel.
8. The sampling method according to claim 7, characterized in that: The control module adjusts the first configuration parameter and / or the second configuration parameter according to the comparison signal, further comprising: If the target comparison signal still does not meet the preset condition when the preset number of adjustments is reached, an interrupt is triggered.
9. A control chip, characterized in that: The sampling circuit comprises the sampling circuit according to any one of claims 1 to 5.
10. A control device, characterized in that: Including the control chip described in claim 9.