ADC sampling method, apparatus and device, and storage medium
By calculating the slope change data between sampling points during the ADC sampling process and dynamically adjusting the sampling period and data, the problem of low sampling accuracy is solved and more accurate signal sampling and measurement is achieved.
Patent Information
- Application Number
- CN202411215905.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-30
- Publication Date
- 2024-12-13
AI Technical Summary
There are signal abnormalities during the ADC sampling process, resulting in deviations in the sampling results, which are difficult to identify and process in the prior art, resulting in low sampling accuracy and inaccurate data.
By obtaining the sampling voltage data during the sampling period, calculating the slope change data between the sampling points, filtering the sampling data, dynamically adjusting the sampling period and data, eliminating the overshoot points, and improving the sampling accuracy.
Effectively avoid overshoot, improve the accuracy of ADC sampling and the accuracy of measurement values, and ensure the stability and accuracy of sampling results.
Smart Images

Figure CN119135175A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of signal processing technology, and in particular to ADC sampling methods, devices, equipment and storage media. Background Art
[0002] In modern electronic devices, the sampling and digital processing of analog signals is a crucial link. The analog-to-digital converter (ADC) is the core component to achieve this conversion. ADC sampling is widely used in audio processing, communication systems, sensor signal processing and other fields. In order to obtain high-precision digital signals, it is necessary to ensure that the sampling point can truly reflect the actual voltage value of the measured signal during the sampling process.
[0003] However, during the sampling process, there will be signal anomalies, but the signal anomalies cannot be identified during sampling and there is no corresponding processing method, which leads to deviations in the sampling results. Summary of the invention
[0004] The main purpose of the present application is to provide an ADC sampling method, device, equipment and storage medium, aiming to solve the technical problem that the ADC sampling accuracy is low and the data is not accurate enough.
[0005] To achieve the above object, the present application proposes an ADC sampling method, the ADC sampling method comprising:
[0006] When ADC sampling is performed within the sampling period, sampling voltage data is obtained;
[0007] Determine slope change data between sampling points according to the sampled voltage data;
[0008] The sampling data is screened according to the slope change data to obtain target sampling data.
[0009] In one embodiment, the step of determining the slope change data between sampling points according to the sampled voltage data comprises:
[0010] Obtaining a current sampling voltage and a historical sampling voltage according to the sampling voltage data;
[0011] Get the current sampling time and historical sampling time;
[0012] The slope change data between sampling points is calculated according to the current sampling voltage, the historical sampling voltage, the current sampling time and the historical sampling time.
[0013] In one embodiment, the step of calculating the slope change data between sampling points according to the current sampling voltage, the historical sampling voltage, the current sampling time and the historical sampling time comprises:
[0014] Calculating a voltage difference according to the current sampled voltage and the historical sampled voltage;
[0015] Calculate the time interval according to the current sampling time and the historical sampling time;
[0016] Calculate the slope value between sampling points according to the time interval and the voltage difference;
[0017] Slope change data is obtained according to the slope value.
[0018] In one embodiment, the filtering of the sampled data according to the slope change data to obtain the target sampled data includes:
[0019] Obtaining a current slope value and a historical slope value according to the slope change data;
[0020] Calculating a slope change difference according to the current slope value and the historical slope value;
[0021] The sampling data is screened according to the slope change difference to obtain target sampling data.
[0022] In one embodiment, the filtering the sampled data according to the slope change difference to obtain the target sampled data includes:
[0023] comparing the slope change difference with a preset slope change threshold;
[0024] When the slope change difference is greater than the preset slope change threshold, determining that the current sampling point has an overshoot, and removing the current sampling time and the current sampling point from the sampling data;
[0025] The sampling period is increased according to a preset rule to obtain an increased sampling period, and the step of obtaining sampled voltage data when ADC sampling is performed within the sampling period is returned to until the increased sampling period is completed to obtain target sampling data.
[0026] In one embodiment, after the step of comparing the slope change difference with a preset slope change threshold, the method further includes:
[0027] When the slope change difference is less than or equal to the preset slope change threshold, determining that there is no overshoot at the current sampling point, and adding the current sampling time and the current sampling point to the sampling data;
[0028] Updating the historical sampling value and the historical slope value through the current sampling point, and reducing the sampling period through a preset rule to obtain a reduced sampling period;
[0029] The value of the stable sampling point counter is modified, and the step of obtaining the sampled voltage data when the ADC sampling is performed within the sampling period is returned until the reduced sampling period is completed or the value of the stable sampling point counter reaches a preset value, thereby obtaining the target sampling data.
[0030] In one embodiment, after the step of screening the sampled data according to the slope change data to obtain the target sampled data, the method further includes:
[0031] Obtaining a target sampling point set according to the target sampling data;
[0032] Fitting the target sampling point set by a preset fitting strategy to obtain a fitting error;
[0033] When the fitting error is within a preset range, a fitting curve, a target sampling point and an overshoot sampling point are output.
[0034] In addition, to achieve the above-mentioned purpose, the present application also proposes an ADC sampling device, the ADC sampling device comprising:
[0035] An acquisition module is used to acquire sampled voltage data when ADC sampling is performed within a sampling period;
[0036] A determination module, used for calculating slope change data between sampling points according to the sampled voltage data;
[0037] The screening module is used to screen the sampling data according to the slope change data to obtain target sampling data.
[0038] In addition, to achieve the above-mentioned purpose, the present application also proposes an ADC sampling device, which includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program is configured to implement the steps of the ADC sampling method described above.
[0039] In addition, to achieve the above-mentioned purpose, the present application also proposes a storage medium, which is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by a processor, the steps of the ADC sampling method described above are implemented.
[0040] In addition, to achieve the above-mentioned purpose, the present application also provides a computer program product, wherein the computer program product includes a computer program, and when the computer program is executed by a processor, the steps of the ADC sampling method described above are implemented.
[0041] One or more technical solutions proposed in the present application obtain sampled voltage data when performing ADC sampling within a sampling period; determine slope change data between sampling points based on the sampled voltage data; filter the sampled data based on the slope change data to obtain target sampled data, and calculate the slope change between consecutive sampling points in real time, thereby introducing a dynamic adjustment mechanism based on the slope change, dynamically adjusting and filtering the sampled data, improving the accuracy of ADC sampling, and thus improving the accuracy of the measured value. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0043] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0044] Figure 1 A schematic diagram of a flow chart provided for the first embodiment of the ADC sampling method of the present application;
[0045] Figure 2 This is a schematic diagram of a fitted signal curve output in an embodiment of the ADC sampling method of the present application;
[0046] Figure 3 This is a schematic diagram of an overshoot sampling point in an embodiment of the ADC sampling method of the present application;
[0047] Figure 4 A schematic diagram of a flow chart provided for the second embodiment of the ADC sampling method of the present application;
[0048] Figure 5 A schematic diagram of a flow chart provided for the third embodiment of the ADC sampling method of the present application;
[0049] Figure 6 This is a schematic diagram of the module structure of the ADC sampling device according to an embodiment of the present application;
[0050] Figure 7 This is a schematic diagram of the device structure of the hardware operating environment involved in the ADC sampling method in the embodiment of the present application.
[0051] The purpose, features and advantages of this application will be further described in conjunction with the embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0052] 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.
[0053] In order to better understand the technical solution of the present application, a detailed description will be given below in conjunction with the accompanying drawings and specific implementation methods.
[0054] The main solution of the embodiment of the present application is: when performing ADC sampling within a sampling period, obtaining sampling voltage data; determining the slope change data between sampling points based on the sampling voltage data; and filtering the sampling data based on the slope change data to obtain target sampling data.
[0055] Since the existing technology is difficult to avoid overshoot during ADC sampling, high-frequency signals or rapidly changing signals are prone to overshoot, causing the sampling value to deviate from the actual value. In addition, fixed-cycle sampling is mostly used, and there is a lack of intelligent judgment of signal change trends. The error caused by overshoot cannot be effectively filtered out. The lack of an intelligent judgment mechanism leads to deviations in the sampling results, thereby affecting the accuracy of the final measurement value.
[0056] The present application provides a solution that intelligently determines slope changes by sampling voltage data, thereby dynamically adjusting the sampled data and effectively avoiding overshoot.
[0057] It should be noted that the execution subject of this embodiment can be a computing service device with data processing, network communication and program running functions, such as a tablet computer, a personal computer, a mobile phone, etc., or an electronic device capable of realizing the above functions, an ADC sampling device, etc. The following takes the ADC sampling device as an example to illustrate this embodiment and the following embodiments.
[0058] Based on this, the embodiment of the present application provides an ADC sampling method, referring to Figure 1 , Figure 1 This is a flow chart of the first embodiment of the ADC sampling method of the present application.
[0059] In this embodiment, the ADC sampling method includes steps S10 to S30:
[0060] Step S10: when performing ADC sampling within a sampling period, obtaining sampled voltage data.
[0061] It should be noted that ADC (Analog-to-Digital Converter) sampling allows analog signals to be sampled periodically in time, and the value of each sampling point is read and converted into digital form to facilitate subsequent digital signal processing and storage.
[0062] It is understandable that before ADC sampling, a sampling period and other sampling parameters may be set first, and this sampling period is the initial sampling period, and ADC sampling may be performed within the sampling period. Other sampling parameters may include a maximum number of sampling times, a preset slope change threshold, and the like.
[0063] When sampling starts, the sampled voltage value of the device to be sampled can be collected. At different sampling times, different sampled voltage values can be obtained, thereby forming sampled voltage data. The sampled voltage data includes sampled voltages at different sampling times, and may include sampled voltage values at the current sampling time, and may also include sampled voltage values at historical sampling times.
[0064] Step S20: determining slope change data between sampling points according to the sampled voltage data.
[0065] In a specific implementation, the slope change data between sampling points can be calculated by sampling voltage data. The slope change data is the slope change corresponding to different sampling points, which can be calculated by sampling voltages at different sampling points. The slope change data is a summary of the slope changes between adjacent sampling points.
[0066] By calculating the slope change of the analog signal between adjacent sampling points, the dynamic characteristics of the signal can be analyzed.
[0067] Step S30: screening the sampling data according to the slope change data to obtain target sampling data.
[0068] In a specific implementation, the slope change data can be used to determine whether the sampled data needs to be retained, thereby screening the sampled data to obtain sampled data that meets the requirements, i.e., target sampled data. The sampling points corresponding to the target sampled data are stable sampling points, and the obtained sampled data are also stable sampling data, which improves the accuracy of subsequent data processing.
[0069] In a feasible implementation manner, after step S30, steps S31 to S33 are further included:
[0070] Step S31: obtaining a target sampling point set according to the target sampling data.
[0071] The prior art lacks the ability to fit the signal waveform when processing fast-changing signals, and it is difficult to accurately reflect the true waveform of the signal. Therefore, after obtaining a series of stable sampling points, this embodiment can fit the sampling points to reconstruct the signal waveform and further improve the accuracy of the signal.
[0072] When fitting, the reserved sampling point set can be used for fitting, so the target sampling point set {t i , v i}, ti is the sampling time, v i is the sampled voltage value.
[0073] Step S32: fitting the target sampling point set using a preset fitting strategy to obtain a fitting error.
[0074] In a specific implementation, the preset fitting strategy may be polynomial fitting or spline fitting. If the preset fitting strategy is polynomial fitting, the least squares method or fitting function may be used to perform polynomial fitting to obtain a fitting error.
[0075] If the preset fitting strategy is spline fitting, the spline interpolation algorithm can be used to perform spline interpolation on the sampling points and calculate the fitting error. When the fitting error meets the requirements, a continuous and smooth fitting curve is obtained.
[0076] Step S33: when the fitting error is within a preset range, outputting the fitting curve, the target sampling point and the overshoot sampling point.
[0077] It is understandable that the preset range can be set in advance, and whether the fitting effect meets the requirements can be determined by detecting whether the fitting error is within the preset range. If the fitting error is not within the preset range, the target sampling point can be adjusted or the fitting algorithm can be used to re-fit.
[0078] If the fitting error is within the preset range, the fitting curve, target sampling point and overshoot sampling point can be output. Overshoot sampling point is a sampling point that exceeds the expected value, such as a sampling point where the slope change does not meet the requirements. By performing data fitting in real time during the sampling process, the signal is estimated and corrected to improve the accuracy of signal restoration.
[0079] like Figure 2 As shown, Figure 2 The output signal curve V after fitting fit (t), by fitting the signal, a continuous and smooth fitting curve is obtained. The points in the figure are the target sampling points. Figure 3 As shown, Figure 3 Schematic diagram of overshoot sampling points, including overshoot sampling points and corresponding sampling times.
[0080] The present embodiment provides an ADC sampling method, which acquires sampled voltage data when performing ADC sampling within a sampling period; determines slope change data between sampling points based on the sampled voltage data; filters the sampled data based on the slope change data to obtain target sampled data, and calculates the slope change between consecutive sampling points in real time, thereby introducing a dynamic adjustment mechanism based on the slope change, dynamically adjusting and filtering the sampled data, improving the accuracy of ADC sampling, and thus improving the accuracy of the measured value.
[0081] Based on the first embodiment of the present application, in the second embodiment of the present application, the same or similar contents as those in the above-mentioned embodiment 1 can be referred to the above introduction, and will not be repeated in the following. Figure 4 , step S20 includes steps S201 to S203:
[0082] Step S201: obtaining a current sampling voltage and a historical sampling voltage according to the sampling voltage data.
[0083] It should be noted that the sampled voltage data includes sampled voltages at different sampling times, so the current sampled voltage and the previous sampled voltage of the current sampled voltage, that is, the historical sampled voltage, can be obtained. For example, the current time is t, and the current sampled voltage at time t and the historical sampled voltage at time t-1 are obtained according to the sampled voltage data.
[0084] Step S202: Obtain the current sampling time and the historical sampling time.
[0085] In a specific implementation, the current sampling time t and the historical sampling time t-1 may be obtained.
[0086] Step S203: calculating slope change data between sampling points according to the current sampling voltage, the historical sampling voltage, the current sampling time and the historical sampling time.
[0087] It is understandable that the voltage difference can be calculated by the current sampling voltage and the historical sampling voltage, and the time difference can be calculated by the current sampling time and the historical sampling time, so as to calculate the slope change data between the sampling points according to the voltage difference and the time difference. The slope change data between the sampling points is the slope change of adjacent sampling points.
[0088] In a feasible implementation, step S203 may include steps A10 to A14:
[0089] Step A11: Calculate a voltage difference according to the current sampled voltage and the historical sampled voltage.
[0090] It can be understood that the voltage difference can be calculated according to the current sampled voltage V1 and the historical sampled voltage V2, and the voltage difference V= V1 - V2.
[0091] Step A12: Calculate the time interval according to the current sampling time and the historical sampling time.
[0092] In a specific implementation, the time interval may be calculated by the current sampling time t and the historical sampling time t-1, and the time interval Δt=t-(t-1).
[0093] Step A13: Calculate the slope value between sampling points according to the time interval and the voltage difference.
[0094] It should be noted that the slope value between the sampling points can be calculated by the time interval and the voltage difference. The slope value is calculated as follows:
[0095]
[0096] In a specific implementation, S is a slope value. The slope values of adjacent sampling points at different times can be calculated according to the above formula 1.
[0097] Step A14: Obtain slope change data according to the slope value.
[0098] By summarizing the slope values at different sampling moments, the slope change data is obtained.
[0099] This embodiment obtains the current sampling voltage and the historical sampling voltage according to the sampling voltage data; obtains the current sampling time and the historical sampling time; calculates the slope change data between the sampling points according to the current sampling voltage, the historical sampling voltage, the current sampling time and the historical sampling time. By calculating the slope between adjacent sampling points, the effective signal components are identified, which can partially compensate for the quantization error and improve the digital representation accuracy of the signal.
[0100] Based on the first embodiment of the present application, in the third embodiment of the present application, the same or similar contents as those in the above-mentioned embodiment 1 can be referred to the above introduction, and will not be repeated in the following. Figure 5 , step S30 includes steps S301 to S303:
[0101] Step S301: obtaining a current slope value and a historical slope value according to the slope change data.
[0102] It should be noted that the historical slope value may be all slope values before the current slope value, or may be the previous slope value of the current slope value. The current slope value and the historical slope value may be obtained through the slope change data. The current slope value may be greater than the historical slope value, or may be less than or equal to the historical slope value.
[0103] Step S302: Calculate the slope change difference according to the current slope value and the historical slope value.
[0104] It can be understood that the slope change difference can be calculated according to the current slope value and the historical slope value, the slope change difference ΔS=|S1-S2|, ΔS is the slope change difference, S1 is the current slope value, and S2 is the historical slope value.
[0105] Step S303: screening the sampling data according to the slope change difference to obtain target sampling data.
[0106] It should be noted that a standard slope change value may be set, so that the slope change difference value is compared with the standard slope change value, and sampling data that does not meet the requirements is eliminated, thereby obtaining target sampling data corresponding to the stable sampling point.
[0107] In a feasible implementation, step S303 may include steps B10 to B13:
[0108] Step B10: Compare the slope change difference with a preset slope change threshold.
[0109] It is understandable that the preset slope change threshold is a standard slope change value, which can be set to 0.7, 0.8, etc., and this embodiment does not limit this. By comparing the slope change difference with the preset slope change threshold, it is determined whether the sampled data meets the requirements.
[0110] Step B11: when the slope change difference is greater than the preset slope change threshold, it is determined that an overshoot exists at the current sampling point, and the current sampling time and the current sampling point are removed from the sampling data.
[0111] In the specific implementation, when the slope change difference is greater than the preset slope change threshold, it is determined that the current sampling point has overshoot, that is, the sampling point exceeds the expected value and does not meet the requirements, and the current sampling point and the corresponding current sampling time are removed from the sampling data, and the sampling voltage collected at the current sampling point is removed. The data of the current sampling point is abandoned. A dynamic adjustment mechanism is introduced so that the sampling point can intelligently avoid the overshoot area and automatically adjust the sampling period and position.
[0112] Step B13: increasing the sampling period according to a preset rule to obtain an increased sampling period, and returning to the step of acquiring sampled voltage data when performing ADC sampling within the sampling period, until the increased sampling period is completed to obtain target sampling data.
[0113] In a specific implementation, since some sampling points are proposed, which may lead to a lack of sampling data, the sampling period can be increased through preset rules. The preset rules are the calculation method of the sampling period, for example, the increased sampling period = sampling period * 1.1, so that the ADC sampling is performed again within the increased sampling period to obtain the sampled voltage data, and the sampling time is updated until the increased sampling period is completed to obtain the target sampling data.
[0114] It can be understood that when the slope change difference is less than or equal to the preset slope change threshold, the corresponding sampled data may not be eliminated, and after step B10, the following steps are further included:
[0115] When the slope change difference is less than or equal to the preset slope change threshold, it is determined that there is no overshoot at the current sampling point, and the current sampling time and the current sampling point are added to the sampling data; the historical sampling value and the historical slope value are updated through the current sampling point, and the sampling period is reduced according to a preset rule to obtain a reduced sampling period; the value of the stable sampling point counter is modified, and the step of obtaining the sampled voltage data when the ADC sampling is performed within the sampling period is returned until the reduction of the sampling period is completed or the value of the stable sampling point counter reaches a preset value to obtain the target sampling data.
[0116] It should be noted that if the slope change difference is less than or equal to the preset slope change threshold, it proves that the current sampling point meets the requirements and is a stable sampling point, that is, there is no overshoot at the current sampling point, then the current sampling time and the current sampling point can be added to the sampling data, and the current slope and the current sampling value corresponding to the current sampling point are used as the previous slope value and the previous sampling value. Since the acquisition point meets the requirements, the sampling period can be appropriately reduced. The preset rule is the calculation method of the sampling period, for example, the reduced sampling period = sampling period * 0.9, so that ADC sampling is performed within the reduced sampling period to obtain sampled voltage data, and the sampling time is updated until the reduced sampling period is completed to obtain the target sampling data.
[0117] Set a stable sampling point counter to count the number of stable sampling points collected. After collecting a stable sampling point, add 1 to the stable sampling point counter and perform sampling again until the sampling times reach the maximum sampling times or the sampling cycle is reduced or the value of the stable sampling point counter reaches the set value, terminating the sampling cycle.
[0118] This embodiment obtains the current slope value and the historical slope value according to the slope change data; calculates the slope change difference according to the current slope value and the historical slope value; filters the sampling data according to the slope change difference to obtain the target sampling data, adjusts the sampling point according to the slope change difference, discards the sampling data and adjusts the strategy when an overshoot phenomenon is detected, so as to improve the sampling accuracy.
[0119] It should be noted that the above examples are only used to understand the present application and do not constitute a limitation on the ADC sampling method of the present application. More simple transformations based on this technical concept are all within the protection scope of the present application.
[0120] This application also provides an ADC sampling device, please refer to Figure 6 , the ADC sampling device comprises:
[0121] The acquisition module 10 is used to acquire sampled voltage data when ADC sampling is performed within a sampling period.
[0122] The determination module 20 is used to calculate the slope change data between sampling points according to the sampled voltage data.
[0123] The screening module 30 is used to screen the sampling data according to the slope change data to obtain target sampling data.
[0124] The ADC sampling device provided by the present application adopts the ADC sampling method in the above embodiment, which can solve the technical problem that the ADC sampling accuracy is low and the data is not accurate enough. Compared with the prior art, the beneficial effects of the ADC sampling device provided by the present application are the same as the beneficial effects of the ADC sampling method provided by the above embodiment, and the other technical features in the ADC sampling device are the same as the features disclosed in the above embodiment method, which will not be repeated here.
[0125] In one embodiment, the determination module 20 is further used to obtain the current sampling voltage and the historical sampling voltage according to the sampled voltage data; obtain the current sampling time and the historical sampling time; and calculate the slope change data between the sampling points according to the current sampling voltage, the historical sampling voltage, the current sampling time and the historical sampling time.
[0126] In one embodiment, the determination module 20 is further used to calculate a voltage difference based on the current sampling voltage and the historical sampling voltage; calculate a time interval based on the current sampling time and the historical sampling time; calculate a slope value between sampling points based on the time interval and the voltage difference; and obtain slope change data based on the slope value.
[0127] In one embodiment, the screening module 30 is further used to obtain a current slope value and a historical slope value based on the slope change data; calculate a slope change difference based on the current slope value and the historical slope value; and screen the sampling data based on the slope change difference to obtain target sampling data.
[0128] In one embodiment, the screening module 30 is further used to compare the slope change difference with a preset slope change threshold; when the slope change difference is greater than the preset slope change threshold, it is determined that there is an overshoot at the current sampling point, and the current sampling time and the current sampling point are removed from the sampling data; the sampling period is increased according to a preset rule to obtain an increased sampling period, and the step of obtaining the sampled voltage data when performing ADC sampling within the sampling period is returned until the increased sampling period is completed to obtain the target sampling data.
[0129] In one embodiment, the screening module 30 is further used to determine that there is no overshoot at the current sampling point when the slope change difference is less than or equal to the preset slope change threshold, and add the current sampling time and the current sampling point to the sampling data; update the historical sampling value and the historical slope value through the current sampling point, and reduce the sampling period according to the preset rule to obtain a reduced sampling period; modify the value of the stable sampling point counter, and return to the step of obtaining the sampled voltage data when the ADC sampling is performed within the sampling period, until the reduction of the sampling period is completed or the value of the stable sampling point counter reaches the preset value, and the target sampling data is obtained.
[0130] In one embodiment, the screening module 30 is further used to obtain a target sampling point set according to the target sampling data; fit the target sampling point set through a preset fitting strategy to obtain a fitting error; and when the fitting error is within a preset range, output a fitting curve, target sampling points, and overshoot sampling points.
[0131] The present application provides an ADC sampling device, which includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the ADC sampling method in the above-mentioned embodiment 1.
[0132] Reference below Figure 7 , which shows a schematic diagram of the structure of an ADC sampling device suitable for implementing the embodiment of the present application. The ADC sampling device in the embodiment of the present application may include but is not limited to mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Portable Application Descriptions), PMPs (Portable Media Players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Figure 7 The ADC sampling device shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.
[0133] like Figure 7As shown, the ADC sampling device may include a processing device 1001 (e.g., a central processing unit, a graphics processor, etc.), which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM: Read Only Memory) 1002 or a program loaded from a storage device 1003 to a random access memory (RAM: Random Access Memory) 1004. In RAM1004, various programs and data required for the operation of the ADC sampling device are also stored. The processing device 1001, ROM1002, and RAM1004 are connected to each other through a bus 1005. An input / output (I / O) interface 1006 is also connected to the bus. Generally, the following systems can be connected to the I / O interface 1006: an input device 1007 including, for example, a touch screen, a touch pad, a keyboard, a mouse, an image sensor, a microphone, an accelerometer, a gyroscope, etc.; an output device 1008 including, for example, a liquid crystal display (LCD: Liquid Crystal Display), a speaker, a vibrator, etc.; a storage device 1003 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 1009. The communication device 1009 can allow the ADC sampling device to communicate with other devices wirelessly or by wire to exchange data. Although the ADC sampling device with various systems is shown in the figure, it should be understood that it is not required to implement or have all the systems shown. More or fewer systems can be implemented or have alternatively.
[0134] In particular, according to the embodiments disclosed in the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present application include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device, or installed from a storage device 1003, or installed from a ROM 1002. When the computer program is executed by the processing device 1001, the above-mentioned functions defined in the method of the embodiment disclosed in the present application are executed.
[0135] The ADC sampling device provided by the present application adopts the ADC sampling method in the above embodiment, which can solve the technical problem that the ADC sampling accuracy is low and the data is not accurate enough. Compared with the prior art, the beneficial effects of the ADC sampling device provided by the present application are the same as the beneficial effects of the ADC sampling method provided by the above embodiment, and the other technical features in the ADC sampling device are the same as the features disclosed in the method of the previous embodiment, which will not be repeated here.
[0136] It should be understood that the various parts disclosed in this application can be implemented by hardware, software, firmware or a combination thereof. In the description of the above embodiments, specific features, structures, materials or characteristics can be combined in any one or more embodiments or examples in a suitable manner.
[0137] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
[0138] The present application provides a computer-readable storage medium having computer-readable program instructions (ie, computer program) stored thereon, and the computer-readable program instructions are used to execute the ADC sampling method in the above-mentioned embodiment.
[0139] The computer-readable storage medium provided in the present application may be, for example, a USB flash drive, but is not limited to electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, systems or devices, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, system or device. The program code contained on the computer-readable storage medium may be transmitted using any appropriate medium, including but not limited to: wires, optical cables, RF (Radio Frequency), etc., or any suitable combination of the above.
[0140] The computer-readable storage medium may be included in the ADC sampling device; or may exist independently without being assembled into the ADC sampling device.
[0141] The computer-readable storage medium carries one or more programs. When the one or more programs are executed by the ADC sampling device, the ADC sampling device: obtains sampled voltage data when performing ADC sampling within a sampling period; determines slope change data between sampling points according to the sampled voltage data; and screens the sampled data according to the slope change data to obtain target sampled data.
[0142] Computer program code for performing the operations of the present application may be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, C++, and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0143] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present application. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0144] The modules involved in the embodiments described in this application may be implemented by software or hardware, wherein the name of the module does not constitute a limitation on the unit itself in some cases.
[0145] The readable storage medium provided in the present application is a computer-readable storage medium, which stores computer-readable program instructions (i.e., computer programs) for executing the above-mentioned ADC sampling method, and can solve the technical problem that the ADC sampling accuracy is low and the data is not accurate enough. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided in the present application are the same as the beneficial effects of the ADC sampling method provided in the above-mentioned embodiment, and will not be repeated here.
[0146] The present application also provides a computer program product, including a computer program, which implements the steps of the above-mentioned ADC sampling method when executed by a processor.
[0147] The computer program product provided by the present application can solve the technical problem that the ADC sampling accuracy is low and the data is not accurate enough. Compared with the prior art, the beneficial effects of the computer program product provided by the present application are the same as the beneficial effects of the ADC sampling method provided by the above embodiment, which will not be repeated here.
[0148] The above descriptions are only some embodiments of the present application, and are not intended to limit the patent scope of the present application. All equivalent structural changes made using the contents of the present application specification and drawings under the technical concept of the present application, or direct / indirect applications in other related technical fields are included in the patent protection scope of the present application.
Claims
1. An ADC sampling method, characterized in that: The ADC sampling method comprises: When ADC sampling is performed within the sampling period, sampling voltage data is obtained; Determine slope change data between sampling points according to the sampled voltage data; The sampling data is screened according to the slope change data to obtain target sampling data.
2. The method according to claim 1, characterized in that The step of determining the slope change data between sampling points according to the sampled voltage data comprises: Obtaining a current sampling voltage and a historical sampling voltage according to the sampling voltage data; Get the current sampling time and historical sampling time; The slope change data between sampling points is calculated according to the current sampling voltage, the historical sampling voltage, the current sampling time and the historical sampling time.
3. The method according to claim 2, characterized in that The step of calculating the slope change data between sampling points according to the current sampling voltage, the historical sampling voltage, the current sampling time and the historical sampling time comprises: Calculating a voltage difference according to the current sampled voltage and the historical sampled voltage; Calculate the time interval according to the current sampling time and the historical sampling time; Calculate the slope value between sampling points according to the time interval and the voltage difference; Slope change data is obtained according to the slope value.
4. The method according to claim 1, characterized in that The filtering of the sampled data according to the slope change data to obtain the target sampled data comprises: Obtaining a current slope value and a historical slope value according to the slope change data; Calculating a slope change difference according to the current slope value and the historical slope value; The sampling data is screened according to the slope change difference to obtain target sampling data.
5. The method according to claim 4, characterized in that The filtering of the sampling data according to the slope change difference to obtain target sampling data comprises: comparing the slope change difference with a preset slope change threshold; When the slope change difference is greater than the preset slope change threshold, determining that the current sampling point has an overshoot, and removing the current sampling time and the current sampling point from the sampling data; The sampling period is increased according to a preset rule to obtain an increased sampling period, and the step of obtaining sampled voltage data when ADC sampling is performed within the sampling period is returned to until the increased sampling period is completed to obtain target sampling data.
6. The method according to claim 5, characterized in that After the step of comparing the slope change difference with a preset slope change threshold, the method further includes: When the slope change difference is less than or equal to the preset slope change threshold, determining that there is no overshoot at the current sampling point, and adding the current sampling time and the current sampling point to the sampling data; Updating the historical sampling value and the historical slope value through the current sampling point, and reducing the sampling period through a preset rule to obtain a reduced sampling period; The value of the stable sampling point counter is modified, and the step of obtaining the sampled voltage data when the ADC sampling is performed within the sampling period is returned until the reduced sampling period is completed or the value of the stable sampling point counter reaches a preset value, thereby obtaining the target sampling data.
7. The method according to any one of claims 1 to 6, characterized in that After the step of screening the sampled data according to the slope change data to obtain the target sampled data, the method further includes: Obtaining a target sampling point set according to the target sampling data; Fitting the target sampling point set by a preset fitting strategy to obtain a fitting error; When the fitting error is within a preset range, a fitting curve, a target sampling point and an overshoot sampling point are output.
8. An ADC sampling device, characterized in that: The device comprises: An acquisition module is used to acquire sampled voltage data when ADC sampling is performed within a sampling period; A determination module, used for calculating slope change data between sampling points according to the sampled voltage data; The screening module is used to screen the sampling data according to the slope change data to obtain target sampling data.
9. An ADC sampling device, characterized in that: The device comprises: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program is configured to implement the steps of the ADC sampling method according to any one of claims 1 to 7.
10. A storage medium, characterized in that: The storage medium is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by a processor, the steps of the ADC sampling method according to any one of claims 1 to 7 are implemented.
