[go: up one dir, main page]

CN104570858B - The analog signal method of sampling and sampling system - Google Patents

The analog signal method of sampling and sampling system Download PDF

Info

Publication number
CN104570858B
CN104570858B CN201410800121.4A CN201410800121A CN104570858B CN 104570858 B CN104570858 B CN 104570858B CN 201410800121 A CN201410800121 A CN 201410800121A CN 104570858 B CN104570858 B CN 104570858B
Authority
CN
China
Prior art keywords
analog
signal
sampling
microprocessor
digital converter
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201410800121.4A
Other languages
Chinese (zh)
Other versions
CN104570858A (en
Inventor
曾春山
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Clou Electronics Co Ltd
Original Assignee
Shenzhen Clou Electronics Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen Clou Electronics Co Ltd filed Critical Shenzhen Clou Electronics Co Ltd
Priority to CN201410800121.4A priority Critical patent/CN104570858B/en
Publication of CN104570858A publication Critical patent/CN104570858A/en
Application granted granted Critical
Publication of CN104570858B publication Critical patent/CN104570858B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G05CONTROLLING; REGULATING
    • G05BCONTROL OR REGULATING SYSTEMS IN GENERAL; FUNCTIONAL ELEMENTS OF SUCH SYSTEMS; MONITORING OR TESTING ARRANGEMENTS FOR SUCH SYSTEMS OR ELEMENTS
    • G05B19/00Programme-control systems
    • G05B19/02Programme-control systems electric
    • G05B19/04Programme control other than numerical control, i.e. in sequence controllers or logic controllers
    • G05B19/042Programme control other than numerical control, i.e. in sequence controllers or logic controllers using digital processors

Landscapes

  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Engineering & Computer Science (AREA)
  • Automation & Control Theory (AREA)
  • Analogue/Digital Conversion (AREA)
  • Microcomputers (AREA)

Abstract

本发明公开了一种模拟信号采样方法,其包括如下步骤:微处理器进行初始化设置;微处理器选择PWM通道将生成的硬件逻辑信号输出;模拟数字转换器接收到硬件逻辑信号后,模拟数字转换器将采集的采样数据通过SPI接口发送至DMA控制器;DMA控制器的缓冲区存满采样数据时,DMA控制器产生中断信号,并将中断信号和采样数据发送至微处理器;微处理器对采样数据进行分析计算处理。本发明还公开一种采样系统。本发明通过微处理进行初始化设置后,启动模拟数字转换器采集采样数据,达到了不需要对采样过程进行控制的技术效果。同时,本发明的微处理器即可实现模拟信号的高速采样,达到了成本低廉、系统构造精简和设计难度低的技术效果。

The invention discloses an analog signal sampling method, which comprises the following steps: a microprocessor performs initial setting; the microprocessor selects a PWM channel to output the generated hardware logic signal; after the analog-digital converter receives the hardware logic signal, the analog-digital The converter sends the collected sampling data to the DMA controller through the SPI interface; when the buffer of the DMA controller is full of sampling data, the DMA controller generates an interrupt signal, and sends the interrupt signal and sampling data to the microprocessor; the microprocessor Analyze and calculate the sampling data. The invention also discloses a sampling system. The invention starts the analog-to-digital converter to collect the sampling data after initializing and setting by micro-processing, and achieves the technical effect that the sampling process does not need to be controlled. At the same time, the microprocessor of the invention can realize high-speed sampling of analog signals, and achieve the technical effects of low cost, simplified system structure and low design difficulty.

Description

模拟信号采样方法以及采样系统Analog signal sampling method and sampling system

技术领域technical field

本发明属于信号采集领域,尤其涉及一种模拟信号采样方法以及采样系统。The invention belongs to the field of signal acquisition, and in particular relates to an analog signal sampling method and a sampling system.

背景技术Background technique

目前,模拟信号采样技术广泛应用到通信行业的通信设备中,因此,出现多种多样的模拟信号采样方法。At present, the analog signal sampling technology is widely used in communication equipment in the communication industry, therefore, various analog signal sampling methods appear.

而现有的主要的模拟信号采样方法为:选择DSP(Digital Signal Processing:数字信号处理器)与FPGA(Field rogrammable Gate Array:现场可编程门阵列)配合使用,来进行模拟信号的高速采样,其中FPGA负责模拟信号高速采样过程的控制,DSP负责采样数据的分析计算And the existing main analog signal sampling method is: select DSP (Digital Signal Processing: Digital Signal Processor) and FPGA (Field programmable Gate Array: Field Programmable Gate Array) to use in conjunction with, carry out the high-speed sampling of analog signal, wherein FPGA is responsible for the control of the high-speed sampling process of analog signals, and DSP is responsible for the analysis and calculation of sampling data

由于现有的模拟信号采集系统既需要DSP,又需要FPGA,所以,造成了构造采样系统成本高的技术问题。同时,由于需要FPGA控制模拟信号高速采样过程,所以,造成采样系统构造复杂且设计难度高等技术问题。Because the existing analog signal acquisition system needs both DSP and FPGA, it causes the technical problem of high cost of constructing the sampling system. At the same time, due to the need for FPGA to control the high-speed sampling process of the analog signal, it causes technical problems such as complex structure of the sampling system and high design difficulty.

综上所述,寻求一种成本低廉,而且构造精简和设计难度低的采样系统是当前亟待解决的技术问题。To sum up, it is an urgent technical problem to seek a sampling system with low cost, simple structure and low design difficulty.

发明内容Contents of the invention

本发明的主要目的在于提供一种模拟信号采样方法以及采样系统,解决现有的采样系统存在的成本高、构造复杂和设计难度高等技术问题。The main purpose of the present invention is to provide an analog signal sampling method and a sampling system to solve the technical problems of high cost, complex structure and difficult design in the existing sampling system.

为实现上述目的,本发明提供了一种模拟信号采样方法,其包括如下步骤:In order to achieve the above object, the invention provides a kind of analog signal sampling method, it comprises the steps:

微处理器进行初始化设置。The microprocessor performs initial settings.

所述微处理器产生硬件逻辑信号,并选择PWM通道输出硬件逻辑信号。The microprocessor generates a hardware logic signal, and selects a PWM channel to output the hardware logic signal.

模拟数字转换器接收到所述硬件逻辑信号后,所述模拟数字转换器采集采样数据,并将所述采样数据通过SPI接口发送至DMA控制器。After the analog-to-digital converter receives the hardware logic signal, the analog-to-digital converter collects sampling data, and sends the sampling data to the DMA controller through the SPI interface.

所述DMA控制器的缓冲区存满所述采样数据时,所述DMA控制器产生中断信号,并将所述中断信号和所述采样数据发送至所述微处理器。When the buffer of the DMA controller is full of the sampled data, the DMA controller generates an interrupt signal, and sends the interrupt signal and the sampled data to the microprocessor.

所述微处理器对所述采样数据进行分析计算处理。The microprocessor analyzes and calculates the sampling data.

优选地,所述微处理器进行初始化设置的步骤,包括:Preferably, the step of performing initialization setting by the microprocessor includes:

所述微处理器获取所述模拟数字转换器的时序参数,并根据所述时序参数设置所述微处理器的PWM模块的输出频率和占空比。The microprocessor acquires timing parameters of the analog-to-digital converter, and sets the output frequency and duty cycle of the PWM module of the microprocessor according to the timing parameters.

所述微处理器设置所述SPI接口的参数。The microprocessor sets parameters of the SPI interface.

所述微处理器设置所述DMA控制器的缓冲区的大小。The microprocessor sets the buffer size of the DMA controller.

优选地,所述微处理器产生硬件逻辑信号,并选择PWM通道输出硬件逻辑信号的步骤,包括:Preferably, the microprocessor generates a hardware logic signal, and the step of selecting the PWM channel to output the hardware logic signal includes:

所述微处理器产生时钟信号、采样信号以及通道切换信号。The microprocessor generates clock signals, sampling signals and channel switching signals.

所述微处理器选择不同的所述PWM通道,并按照设置的所述输出频率和所述占空比分别输出所述时钟信号、所述采样信号以及所述通道切换信号。The microprocessor selects different PWM channels, and outputs the clock signal, the sampling signal and the channel switching signal respectively according to the set output frequency and the duty cycle.

优选地,所述模拟数字转换器接收到所述硬件逻辑信号后,所述模拟数字转换器采集采样数据,并将所述采样数据通过SPI接口发送至DMA控制器的步骤,包括:Preferably, after the analog-to-digital converter receives the hardware logic signal, the analog-to-digital converter collects sampled data, and sends the sampled data to the DMA controller through the SPI interface, including:

所述模拟数字转换器接收通过PWM通道不同发送的所述时钟信号、所述采样信号以及所述通道切换信号。The analog-to-digital converter receives the clock signal, the sampling signal, and the channel switching signal that are differently sent through the PWM channel.

所述模拟数字转换器根据所述时钟信号和所述采样信号采集所述采样数据。The analog-to-digital converter collects the sampling data according to the clock signal and the sampling signal.

所述模拟数字转换器根据所述通道切换信号将所述采样数据通过所述SPI接口发送至所述DMA控制器。The analog-to-digital converter sends the sampling data to the DMA controller through the SPI interface according to the channel switching signal.

优选地,所述微处理器对所述采样数据进行分析计算处理的步骤,包括:Preferably, the step of analyzing and calculating the sampling data by the microprocessor includes:

所述微处理器根据所述采样数据判断所述微处理器的PWM模块是否正常工作。The microprocessor judges whether the PWM module of the microprocessor is working normally according to the sampling data.

所述微处理器根据所述采样数据判断所述模拟数字转换器是否正常采集采样数据。The microprocessor judges whether the analog-to-digital converter collects sampled data normally according to the sampled data.

此外,为实现上述目的,本发明还提供了一种模拟信号采样系统,其包括微处理器、模拟数字转换器、DMA控制器,所述微处理器与所述模拟数字转换器通过PWM通道通信连接,所述模拟数字转换器与所述DMA控制器通过SPI接口通信连接,所述微处理器与所述DMA控制器之间通信连接,所述微处理器用于初始化设置、还用于产生硬件逻辑信号和选择PWM通道输出硬件逻辑信号、以及对采样数据进行分析计算处理;所述模拟数字转换器用于采集采样数据;所述DMA控制器用于存储采样数据以及产生中断信号。In addition, in order to achieve the above object, the present invention also provides an analog signal sampling system, which includes a microprocessor, an analog-to-digital converter, and a DMA controller, and the microprocessor communicates with the analog-to-digital converter through a PWM channel connected, the analog-to-digital converter is connected to the DMA controller through the SPI interface, the microprocessor is connected to the DMA controller, and the microprocessor is used for initializing settings and also for generating hardware The logic signal and the selected PWM channel output hardware logic signals, and analyze and calculate the sampling data; the analog-to-digital converter is used to collect the sampling data; the DMA controller is used to store the sampling data and generate an interrupt signal.

优选地,所述微处理器包括获取模块、后台处理模块、PWM模块、后台通信模块以及判断模块。Preferably, the microprocessor includes an acquisition module, a background processing module, a PWM module, a background communication module and a judging module.

所述获取模块,用于获取所述模拟数字转换器的时序参数。The acquiring module is configured to acquire timing parameters of the analog-to-digital converter.

所述后台处理模块,用于根据所述时序参数设置所述PWM模块的输出频率和占空比,还用于设置所述SPI接口的参数,还用于设置所述DMA控制器的缓冲区的大小,以及产生硬件逻辑信号和选择PWM通道。The background processing module is used to set the output frequency and duty cycle of the PWM module according to the timing parameters, is also used to set the parameters of the SPI interface, and is also used to set the buffer of the DMA controller size, as well as generating hardware logic signals and selecting PWM channels.

所述后台通信模块,用于发送所述硬件逻辑信号至模拟数字转换器。The background communication module is used to send the hardware logic signal to the analog-to-digital converter.

所述判断模块,用于根据所述采样数据判断所述PWM模块是否正常工作以及所述模拟数字转换器是否正常采集采样数据。The judging module is used for judging whether the PWM module works normally and whether the analog-to-digital converter collects sampling data normally according to the sampling data.

优选地,所述后台处理模块包括时钟信号生成单元、采样信号生成单元、通道切换信号生成单元、以及PWM通道选择单元。Preferably, the background processing module includes a clock signal generation unit, a sampling signal generation unit, a channel switching signal generation unit, and a PWM channel selection unit.

所述时钟信号生成单元,用于生成时钟信号。The clock signal generating unit is configured to generate a clock signal.

所述采样信号生成单元,用于生成采样信号。The sampling signal generating unit is configured to generate a sampling signal.

所述通道切换信号生成单元,用于生成通道切换信号。The channel switching signal generating unit is configured to generate a channel switching signal.

所述PWM通道选择单元,用于根据时钟信号、采样信号或通道切换信号选择PWM通道。The PWM channel selection unit is used to select a PWM channel according to a clock signal, a sampling signal or a channel switching signal.

优选地,所述模拟数字转换器包括模数转换器处理模块、模数转换器通信模块。Preferably, the analog-to-digital converter includes an analog-to-digital converter processing module and an analog-to-digital converter communication module.

所述模数转换器处理模块,用于根据所述时钟信号和所述采样信号采集采样数据。The analog-to-digital converter processing module is configured to collect sampling data according to the clock signal and the sampling signal.

所述模数转换器通信模块,用于接收所述时钟信号、所述采样信号以及所述通道切换信号,以及用于发送所述采样数据至所述DMA控制器。The analog-to-digital converter communication module is used for receiving the clock signal, the sampling signal and the channel switching signal, and for sending the sampling data to the DMA controller.

优选地,所述DMA控制器包括DMA控制器处理模块和DMA控制器通信模块。Preferably, the DMA controller includes a DMA controller processing module and a DMA controller communication module.

所述DMA控制器处理模块,用于将所述采样数据存储至缓冲区,以及用于产生中断信号。The DMA controller processing module is used to store the sampling data into a buffer, and to generate an interrupt signal.

所述DMA控制器通信模块,用于接收所述采样数据,以及发送中断信号至微处理器。The DMA controller communication module is used to receive the sampling data and send an interrupt signal to the microprocessor.

本发明通过微处理进行初始化设置后,启动模拟数字转换器采集采样数据,达到了不需要对采样过程进行控制的技术效果。同时,本发明的微处理器即可实现模拟信号的高速采样,达到了成本低廉、系统构造精简和设计难度低的技术效果。The invention starts the analog-to-digital converter to collect the sampling data after initializing and setting through the micro-processing, and achieves the technical effect that the sampling process does not need to be controlled. At the same time, the microprocessor of the invention can realize high-speed sampling of analog signals, and achieve the technical effects of low cost, simplified system structure and low design difficulty.

说明书附图Instructions attached

图1为本发明模拟信号采样方法实施例1的流程示意图;Fig. 1 is the schematic flow chart of embodiment 1 of analog signal sampling method of the present invention;

图2为本发明模拟信号采样方法实施例2的流程示意图;Fig. 2 is a schematic flow chart of Embodiment 2 of the analog signal sampling method of the present invention;

图3为本发明模拟信号采样方法实施例3的流程示意图;Fig. 3 is a schematic flow chart of Embodiment 3 of the analog signal sampling method of the present invention;

图4为本发明模拟信号采样方法实施例4的流程示意图;Fig. 4 is a schematic flow chart of Embodiment 4 of the analog signal sampling method of the present invention;

图5为本发明模拟信号采样方法实施例5的流程示意图;Fig. 5 is a schematic flow chart of Embodiment 5 of the analog signal sampling method of the present invention;

图6为本发明模拟信号采样系统实施例6的方框示意图;6 is a schematic block diagram of Embodiment 6 of the analog signal sampling system of the present invention;

图7为本发明模拟信号采样系统中微处理器实施例7的功能模块示意图;Fig. 7 is the functional module schematic diagram of embodiment 7 of the microprocessor in the analog signal sampling system of the present invention;

图8为本发明模拟信号采样系统中模拟数字转换器实施例8的功能模块示意图;8 is a schematic diagram of functional modules of Embodiment 8 of the analog-to-digital converter in the analog signal sampling system of the present invention;

图9为本发明模拟信号采样系统中DMA控制器实施例9的功能模块示意图。FIG. 9 is a schematic diagram of functional modules of Embodiment 9 of the DMA controller in the analog signal sampling system of the present invention.

具体实施方式detailed description

为了使本发明的目的、技术方案及优点更加清楚明白,以下结合附图及实施例,对本发明进行进一步详细说明。应当理解,此处所描述的具体实施例仅仅用以解释本发明,并不用来限定本发明。In order to make the object, technical solution and advantages of the present invention clearer, the present invention will be further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described here are only used to explain the present invention, not to limit the present invention.

实施例1Example 1

参见图1,图1为本发明模拟信号采样方法实施例1的流程示意图。Referring to FIG. 1 , FIG. 1 is a schematic flowchart of Embodiment 1 of the analog signal sampling method of the present invention.

在实施例1中,本发明提供了一种模拟信号采样方法,其包括如下步骤:In embodiment 1, the present invention provides a kind of analog signal sampling method, it comprises the steps:

步骤S10,微处理器进行初始化设置。Step S10, the microprocessor performs initialization settings.

微处理包括PWM(Pulse Width Modulation:脉冲宽度调制)模块、SPI(SerialControl Interface:串行外设接口)接口以及DMA(Direct Memory Access:直接存储器访问)控制器。微处理器对PWM模块、SPI接口以及DMA控制器等进行参数设置,以致后续的ADC(Analog-to-Digital Control模拟数字转换器)采集采样数据时,微处理不需要对采样过程进行控制。达到了提升微处理器的处理效果的技术效果。The microprocessor includes a PWM (Pulse Width Modulation: Pulse Width Modulation) module, an SPI (Serial Control Interface: Serial Peripheral Interface) interface, and a DMA (Direct Memory Access: Direct Memory Access) controller. The microprocessor sets parameters for the PWM module, SPI interface, and DMA controller, so that when the subsequent ADC (Analog-to-Digital Control Analog-to-Digital Converter) collects sampling data, the microprocessor does not need to control the sampling process. The technical effect of improving the processing effect of the microprocessor is achieved.

步骤S11,所述微处理器产生硬件逻辑信号,并选择PWM通道输出硬件逻辑信号。Step S11, the microprocessor generates a hardware logic signal, and selects a PWM channel to output the hardware logic signal.

微处理初始化设置操作完成后,微处理器生成与ADC采样相关的硬件逻辑信号。同时,选择相应的PWM通道输出硬件逻辑信号。After the microprocessor initialization setting operation is completed, the microprocessor generates hardware logic signals related to ADC sampling. At the same time, select the corresponding PWM channel to output hardware logic signals.

由于本发明通过微处理进行了对PWM模块的初始化设置操作,所以,当本发明通过选择的PWM通道输出硬件逻辑信号时,输出的硬件逻辑信号的输出频率、占空比均符合设置的需求。因此,达到了微处理器不用对采样过程进行控制的技术效果。Since the present invention has carried out the initial setting operation of the PWM module through microprocessing, when the present invention outputs the hardware logic signal through the selected PWM channel, the output frequency and duty cycle of the output hardware logic signal meet the setting requirements. Therefore, the technical effect that the microprocessor does not need to control the sampling process is achieved.

步骤S12,模拟数字转换器接收到所述硬件逻辑信号后,所述模拟数字转换器采集采样数据,并将所述采样数据通过SPI接口发送至DMA控制器。Step S12, after the analog-to-digital converter receives the hardware logic signal, the analog-to-digital converter collects sampling data, and sends the sampling data to the DMA controller through the SPI interface.

当模拟数字转换器接收到硬件逻辑信号后,启动采样数据的采集,并将采集的采样数据通过SPI接口传输至DMA控制器。When the analog-to-digital converter receives the hardware logic signal, it starts to collect the sampling data, and transmits the collected sampling data to the DMA controller through the SPI interface.

由于本发明微处理器对SPI接口进行了初始化设置操作,所以,通过SPI接口传输至DMA控制的采样数据均是符合要求的采样数据,达到了进一步保证采样过程不需要微处理器进行控制的技术效果。Because the microprocessor of the present invention has carried out the initial setting operation to the SPI interface, so, the sampling data transmitted to the DMA control through the SPI interface is all sampling data that meets the requirements, and the technology that further ensures that the sampling process does not need the microprocessor to be controlled Effect.

步骤S13,所述DMA控制器的缓冲区存满所述采样数据时,所述DMA控制器产生中断信号,并将所述中断信号和所述采样数据发送至所述微处理器。Step S13, when the buffer of the DMA controller is full of the sampled data, the DMA controller generates an interrupt signal, and sends the interrupt signal and the sampled data to the microprocessor.

当DMA控制器的缓冲区存满采样数据时,DMA控制器生成中断信号,DMA将该中断信号发送至微处理器,微处理器接收到该中断信号后,接收DMA控制器发送的采样数据。When the buffer of the DMA controller is full of sampling data, the DMA controller generates an interrupt signal, and the DMA sends the interrupt signal to the microprocessor. After receiving the interrupt signal, the microprocessor receives the sampling data sent by the DMA controller.

步骤S14,所述微处理器对所述采样数据进行分析计算处理。Step S14, the microprocessor analyzes and calculates the sampled data.

微处理器接收完成DMA控制器发送的采样数据后,对该采样数据进行分析计算处理操作。After the microprocessor receives the sampling data sent by the DMA controller, it analyzes, calculates, and processes the sampling data.

本发明通过微处理进行初始化设置后,启动模拟数字转换器采集采样数据,达到了不需要对采样过程进行控制的技术效果。同时,本发明的微处理器即可实现模拟信号的高速采样,达到了成本低廉、系统构造精简和设计难度低的技术效果。The invention starts the analog-to-digital converter to collect the sampling data after initializing and setting through the micro-processing, and achieves the technical effect that the sampling process does not need to be controlled. At the same time, the microprocessor of the invention can realize high-speed sampling of analog signals, and achieve the technical effects of low cost, simplified system structure and low design difficulty.

实施例2Example 2

参见图2,图2为本发明模拟信号采样方法实施例2的流程示意图。Referring to FIG. 2 , FIG. 2 is a schematic flowchart of Embodiment 2 of the analog signal sampling method of the present invention.

在实施例2中,与上述实施例1的步骤基本相同,不同之处在于,所述步骤S10,包括:In embodiment 2, the steps are basically the same as those in the above embodiment 1, except that the step S10 includes:

步骤S20,所述微处理器获取所述模拟数字转换器的时序参数,并根据所述时序参数设置所述微处理器的PWM模块的输出频率和占空比。Step S20, the microprocessor acquires timing parameters of the analog-to-digital converter, and sets the output frequency and duty cycle of the PWM module of the microprocessor according to the timing parameters.

微处理器获取模拟数字转换器的时序参数,再根据该时序参数设置的PWM模块的输出频率和占空比,以致微处理生成的硬件逻辑信号通过PWM通道输出后,其输出频率和占空比与设置的输出频率和占空比一致。The microprocessor obtains the timing parameters of the analog-to-digital converter, and then sets the output frequency and duty cycle of the PWM module according to the timing parameters, so that after the hardware logic signal generated by the microprocessor is output through the PWM channel, its output frequency and duty cycle Consistent with the set output frequency and duty cycle.

步骤S21,所述微处理器设置所述SPI接口的参数。Step S21, the microprocessor sets the parameters of the SPI interface.

微处理器对SPI接口的参数进行设置,以致模拟数字转换器通过SPI接收发送至DMA控制器的采样数据是符合设置要求的采样数据,达到了对符合设置要求的采样数据的过滤的技术效果。The microprocessor sets the parameters of the SPI interface, so that the sampling data received by the analog-to-digital converter and sent to the DMA controller through the SPI is the sampling data that meets the setting requirements, and the technical effect of filtering the sampling data that meets the setting requirements is achieved.

步骤S22,所述微处理器设置所述DMA控制器的缓冲区的大小。Step S22, the microprocessor sets the buffer size of the DMA controller.

微处理器设置DMA控制器的缓冲区的大小,达到了微处理器可以根据具体的情况,决定最佳的时间间隔对采样数据进行一次分析计算处理,达到了加快微处理器的处理效率的技术效果。The microprocessor sets the buffer size of the DMA controller, so that the microprocessor can determine the best time interval to analyze and calculate the sampling data according to the specific situation, and achieve the technology of speeding up the processing efficiency of the microprocessor Effect.

实施例3Example 3

参见图3,图3为本发明模拟信号采样方法实施例3的流程示意图。Referring to FIG. 3 , FIG. 3 is a schematic flowchart of Embodiment 3 of the analog signal sampling method of the present invention.

在实施例3中,与上述实施例2的步骤基本相同,不同之处在于,所述步骤S11,包括:In embodiment 3, the steps are basically the same as those in the above embodiment 2, except that the step S11 includes:

步骤S30,所述微处理器产生时钟信号、采样信号以及通道切换信号。Step S30, the microprocessor generates a clock signal, a sampling signal and a channel switching signal.

微处理器初始化设置操作完成后,微处理器生成了时钟信号(ad_clock)、采样信号(ad_start)以及通道切换信号(ad_sel)。After the initialization setting operation of the microprocessor is completed, the microprocessor generates a clock signal (ad_clock), a sampling signal (ad_start) and a channel switching signal (ad_sel).

步骤S31,所述微处理器选择不同的所述PWM通道,并按照设置的所述输出频率和所述占空比分别输出所述时钟信号、所述采样信号以及所述通道切换信号。Step S31, the microprocessor selects different PWM channels, and outputs the clock signal, the sampling signal and the channel switching signal respectively according to the set output frequency and the duty cycle.

微处理器针对选择一个PWM通道输出时钟信号(ad_clock),该时钟信号的输出频率、占空比与微处理器设置PWM模块的输出频率和占空比一致。The microprocessor outputs a clock signal (ad_clock) for selecting a PWM channel, and the output frequency and duty cycle of the clock signal are consistent with the output frequency and duty cycle of the PWM module set by the microprocessor.

微处理器针对选择一个PWM通道输出采样信号(ad_start),该采样信号的输出频率、占空比与微处理器设置PWM模块的输出频率和占空比一致。The microprocessor outputs a sampling signal (ad_start) for selecting a PWM channel, and the output frequency and duty cycle of the sampling signal are consistent with the output frequency and duty cycle of the PWM module set by the microprocessor.

微处理器针对选择一个PWM通道输出通道切换信号(ad_sel),该通道切换信号的输出频率、占空比与微处理器设置PWM模块的输出频率和占空比一致。The microprocessor outputs a channel switching signal (ad_sel) for selecting a PWM channel, and the output frequency and duty cycle of the channel switching signal are consistent with the output frequency and duty cycle of the PWM module set by the microprocessor.

本发明通过微处理器选择不同的PWM通道输出不同的硬件逻辑信号,达到了加快传输速度的技术效果。In the invention, the microprocessor selects different PWM channels to output different hardware logic signals, thereby achieving the technical effect of accelerating the transmission speed.

实施例4Example 4

参见图4,图4为本发明模拟信号采样方法实施例4的流程示意图。Referring to FIG. 4 , FIG. 4 is a schematic flowchart of Embodiment 4 of the analog signal sampling method of the present invention.

在实施例4中,与上述实施例3的步骤基本相同,不同之处在于,所述步骤S12,包括:In Embodiment 4, the steps are basically the same as those in Embodiment 3 above, except that the step S12 includes:

步骤S40,所述模拟数字转换器接收通过不同PWM通道发送的所述时钟信号、所述采样信号以及所述通道切换信号。Step S40, the analog-to-digital converter receives the clock signal, the sampling signal and the channel switching signal sent through different PWM channels.

模拟数字转换器接收通过不同的PWM通道发送的时钟信号、采样信号以及通道切换信号。The analog-to-digital converter receives clock signals, sampling signals and channel switching signals sent through different PWM channels.

步骤S41,所述模拟数字转换器根据所述时钟信号和所述采样信号采集所述采样数据。Step S41, the analog-to-digital converter collects the sampling data according to the clock signal and the sampling signal.

模拟数字转换器接收到时钟信号和采样信号后,开启采集采样数据。After the analog-to-digital converter receives the clock signal and the sampling signal, it starts to collect the sampling data.

步骤S42,所述模拟数字转换器根据所述通道切换信号将所述采样数据通过所述SPI接口发送至所述DMA控制器。Step S42, the analog-to-digital converter sends the sampling data to the DMA controller through the SPI interface according to the channel switching signal.

模拟数字转换器接收到通道切换信号后,将采集的采样数据通过SPI接口发送至DMA控制器。After the analog-to-digital converter receives the channel switching signal, it sends the collected sampling data to the DMA controller through the SPI interface.

实施例5Example 5

参见图5,图5为本发明模拟信号采样方法实施例5的流程示意图。Referring to FIG. 5 , FIG. 5 is a schematic flowchart of Embodiment 5 of the analog signal sampling method of the present invention.

在实施例5中,与上述实施例1的步骤基本相同,不同之处在于,所述步骤S14,包括:In Embodiment 5, the steps are basically the same as those in Embodiment 1 above, except that the step S14 includes:

步骤S50,所述微处理器根据所述采样数据判断所述微处理器的PWM模块是否正常工作;Step S50, the microprocessor judges whether the PWM module of the microprocessor is working normally according to the sampling data;

步骤S51,所述微处理器根据所述采样数据判断所述模拟数字转换器是否正常采集采样数据。Step S51, the microprocessor judges whether the analog-to-digital converter collects sampled data normally according to the sampled data.

本发明的采样数据中包括PWM模块判断数据信息和模拟数字转换器判断数据信息。The sampling data of the present invention includes the judgment data information of the PWM module and the judgment data information of the analog-to-digital converter.

微处理器通过PWM模块判断数据信息判断PWM模块是否正常工作,达到了确保输出的硬件逻辑信号的输出频率和占空比是符合设置要求的技术效果。The microprocessor judges whether the PWM module works normally by judging the data information of the PWM module, and achieves the technical effect of ensuring that the output frequency and duty cycle of the output hardware logic signal meet the setting requirements.

微处理器通过模拟数字转换器判断数据信息判断模拟数字转换器是否正常工作,达到了实时了解数字转换器的工作状态信息的技术效果。The microprocessor judges whether the analog-to-digital converter works normally by judging the data information of the analog-to-digital converter, and achieves the technical effect of knowing the working state information of the digital converter in real time.

实施例6Example 6

参见图6,图6为本发明模拟信号采样系统实施例6的方框示意图。Referring to FIG. 6, FIG. 6 is a schematic block diagram of Embodiment 6 of the analog signal sampling system of the present invention.

此外,为实现上述目的,本发明实施例6还提供了一种模拟信号采样系统,其包括微处理器1、模拟数字转换器2、DMA控制器3,所述微处理器1与所述模拟数字转换器2通过PWM通道4通信连接,所述模拟数字转换器2与所述DMA控制器3通过SPI接口5通信连接,所述微处理器1与所述DMA控制器3之间通信连接,所述微处理器1用于初始化设置、还用于产生硬件逻辑信号和选择PWM通道4输出硬件逻辑信号、以及对采样数据进行分析计算处理;所述模拟数字转换器2用于采集采样数据;所述DMA控制器3用于存储采样数据以及产生中断信号。In addition, in order to achieve the above purpose, Embodiment 6 of the present invention also provides an analog signal sampling system, which includes a microprocessor 1, an analog-to-digital converter 2, and a DMA controller 3. The microprocessor 1 and the analog The digital converter 2 is communicatively connected through the PWM channel 4, the analog-to-digital converter 2 is communicatively connected with the DMA controller 3 through the SPI interface 5, and the microprocessor 1 is communicatively connected with the DMA controller 3, The microprocessor 1 is used to initialize settings, and is also used to generate hardware logic signals and select the PWM channel 4 to output hardware logic signals, and to analyze and calculate the sampled data; the analog-to-digital converter 2 is used to collect the sampled data; The DMA controller 3 is used for storing sampling data and generating interrupt signals.

微处理包括PWM(Pulse Width Modulation:脉冲宽度调制)模块、SPI(SerialControl Interface:串行外设接口)接口以及DMA(Direct Memory Access:直接存储器访问)控制器。The microprocessor includes a PWM (Pulse Width Modulation: Pulse Width Modulation) module, an SPI (Serial Control Interface: Serial Peripheral Interface) interface, and a DMA (Direct Memory Access: Direct Memory Access) controller.

微处理器1对PWM模块、SPI接口以及DMA控制器3等进行参数设置,以致后续的ADC(Analog-to-Digital Control模拟数字转换器2)采集采样数据时,微处理不需要对采样过程进行控制。达到了提升微处理器1的处理效果的技术效果。Microprocessor 1 sets parameters for PWM module, SPI interface, and DMA controller 3, so that when the subsequent ADC (Analog-to-Digital Control Analog-to-Digital Converter 2) collects sampling data, the microprocessing does not need to carry out the sampling process. control. The technical effect of improving the processing effect of the microprocessor 1 is achieved.

微处理初始化设置操作完成后,微处理器1生成与ADC采样相关的硬件逻辑信号。同时,选择相应的PWM通道输出硬件逻辑信号。由于本发明通过微处理进行了对PWM模块的初始化设置操作,所以,当本发明通过选择的PWM通道输出硬件逻辑信号时,输出的硬件逻辑信号的输出频率、占空比均符合设置的需求。因此,达到了微处理器1不用对采样过程进行控制的技术效果。After the microprocessor initialization setting operation is completed, the microprocessor 1 generates hardware logic signals related to ADC sampling. At the same time, select the corresponding PWM channel to output hardware logic signals. Since the present invention has carried out the initial setting operation of the PWM module through microprocessing, when the present invention outputs the hardware logic signal through the selected PWM channel, the output frequency and duty cycle of the output hardware logic signal meet the setting requirements. Therefore, the technical effect that the microprocessor 1 does not need to control the sampling process is achieved.

当模拟数字转换器2接收到硬件逻辑信号后,启动采样数据的采集,并将采集的采样数据通过SPI接口传输至DMA控制器3。When the analog-to-digital converter 2 receives the hardware logic signal, it starts to collect the sampling data, and transmits the collected sampling data to the DMA controller 3 through the SPI interface.

由于本发明微处理器1对SPI接口进行了初始化设置操作,所以,通过SPI接口传输至DMA控制的采样数据均是符合要求的采样数据,达到了进一步保证采样过程不需要微处理器1进行控制的技术效果。Because the microprocessor 1 of the present invention has carried out the initial setting operation to the SPI interface, so, the sampling data transmitted to the DMA control by the SPI interface is all sampling data that meets the requirements, and it is further guaranteed that the sampling process does not need the microprocessor 1 to control technical effect.

当DMA控制器3的缓冲区存满采样数据时,DMA控制器3生成中断信号,DMA将该中断信号发送至微处理器1,微处理器1接收到该中断信号后,接收DMA控制器3发送的采样数据。When the buffer of DMA controller 3 is full of sampling data, DMA controller 3 generates an interrupt signal, and DMA sends the interrupt signal to microprocessor 1. After microprocessor 1 receives the interrupt signal, it receives DMA controller 3 Sent sample data.

微处理器1接收完成DMA控制器3发送的采样数据后,对该采样数据进行分析计算处理操作。After the microprocessor 1 receives the sampling data sent by the DMA controller 3 , it performs analysis, calculation, and processing operations on the sampling data.

本发明通过微处理进行初始化设置后,启动模拟数字转换器2采集采样数据,达到了不需要对采样过程进行控制的技术效果。同时,本发明的微处理器1即可实现模拟信号的高速采样,达到了成本低廉、系统构造精简和设计难度低的技术效果。The present invention starts the analog-to-digital converter 2 to collect sampling data after initializing and setting by microprocessing, and achieves the technical effect that the sampling process does not need to be controlled. At the same time, the microprocessor 1 of the present invention can realize high-speed sampling of analog signals, achieving the technical effects of low cost, simplified system structure and low design difficulty.

实施例7Example 7

参见图7,图7为本发明模拟信号采样系统中微处理器实施例7的功能模块示意图。Referring to FIG. 7 , FIG. 7 is a schematic diagram of the functional modules of Embodiment 7 of the microprocessor in the analog signal sampling system of the present invention.

在实施例7中,与上述实施例6的结构基本相同,不同之处在于,所述微处理器1包括获取模块10、后台处理模块12、PWM模块11、后台通信模块14以及判断模块13。In Embodiment 7, the structure is basically the same as that of Embodiment 6 above, except that the microprocessor 1 includes an acquisition module 10 , a background processing module 12 , a PWM module 11 , a background communication module 14 and a judgment module 13 .

所述获取模块10,用于获取所述模拟数字转换器的时序参数。The acquiring module 10 is configured to acquire timing parameters of the analog-to-digital converter.

微处理器的获取模块10获取模拟数字转换器的时序参数,并将该参数发送至微处理器的后台处理模块12。The acquisition module 10 of the microprocessor acquires the timing parameters of the analog-to-digital converter, and sends the parameters to the background processing module 12 of the microprocessor.

所述后台处理模块12,用于根据所述时序参数设置所述PWM模块11的输出频率和占空比,还用于设置所述SPI接口的参数,还用于设置所述DMA控制器的缓冲区的大小,以及产生硬件逻辑信号和选择PWM通道。The background processing module 12 is used to set the output frequency and duty cycle of the PWM module 11 according to the timing parameters, is also used to set the parameters of the SPI interface, and is also used to set the buffer of the DMA controller The size of the area, as well as generating hardware logic signals and selecting PWM channels.

微处理器1的后台处理模块12根据该时序参数设置PWM模块11的输出频率和占空比,以致微处理器生成的硬件逻辑信号经PWM通道输出时,其输出频率和占空比与设置的输出频率和占空比一致。The background processing module 12 of the microprocessor 1 sets the output frequency and the duty ratio of the PWM module 11 according to the timing parameters, so that when the hardware logic signal generated by the microprocessor is output through the PWM channel, its output frequency and the duty ratio are the same as the set The output frequency is consistent with the duty cycle.

微处理器1的后台处理模块12还设置了SPI接口的参数,以致通过SPI接口输出的采样数均是符合采样要求的采样数据。The background processing module 12 of the microprocessor 1 also sets the parameters of the SPI interface, so that the sampling numbers output through the SPI interface are all sampling data meeting the sampling requirements.

微处理器1的后台处理模块12还设置了DMA控制器的缓冲区的大小,以致经过预设的一段时间后,微处理器对DMA控制器发送的采样数据进行分析处理,达到了提高微处理器的处理效率的技术效果。The background processing module 12 of microprocessor 1 is also provided with the size of the buffer zone of DMA controller, so that after a preset period of time, microprocessor analyzes and processes the sampled data sent by DMA controller, which improves the performance of microprocessing. The technical effect of the processor's processing efficiency.

所述后台通信模块14,用于发送所述硬件逻辑信号至模拟数字转换器。The background communication module 14 is configured to send the hardware logic signal to the analog-to-digital converter.

微处理器1的后台处理模块12生成硬件逻辑信号,并选择不同的PWM通道输出不同的硬件逻辑信号至模拟数字转换器。The background processing module 12 of the microprocessor 1 generates hardware logic signals, and selects different PWM channels to output different hardware logic signals to the analog-to-digital converter.

所述判断模块13,用于根据所述采样数据判断所述PWM模块11是否正常工作以及所述模拟数字转换器是否正常采集采样数据。The judging module 13 is configured to judge whether the PWM module 11 works normally and whether the analog-to-digital converter collects sampling data normally according to the sampling data.

微处理器1的判断模块13对DMA控制器的采样数据进行分析计算处理过程中,可以根据采样数据判断PWM模块11是否正常工作以及所述模拟数字转换器是否正常采集采样数据。The judging module 13 of the microprocessor 1 can judge whether the PWM module 11 works normally and whether the analog-to-digital converter normally collects the sampled data according to the sampled data during the process of analyzing and calculating the sampled data of the DMA controller.

进一步地,所述后台处理模块12包括时钟信号生成单元121、采样信号生成单元122、通道切换信号生成单元123、以及PWM通道选择单元124。Further, the background processing module 12 includes a clock signal generation unit 121 , a sampling signal generation unit 122 , a channel switching signal generation unit 123 , and a PWM channel selection unit 124 .

所述时钟信号生成单元121,用于生成时钟信号。The clock signal generating unit 121 is configured to generate a clock signal.

所述采样信号生成单元122,用于生成采样信号。The sampling signal generation unit 122 is configured to generate a sampling signal.

所述通道切换信号生成单元123,用于生成通道切换信号。The channel switching signal generating unit 123 is configured to generate a channel switching signal.

所述PWM通道选择单元124,用于根据时钟信号、采样信号或通道切换信号选择PWM通道。The PWM channel selection unit 124 is configured to select a PWM channel according to a clock signal, a sampling signal or a channel switching signal.

后台处理模块12的时钟信号生成单元121生成了时钟信号。The clock signal generating unit 121 of the background processing module 12 generates a clock signal.

后台处理模块12的采样信号生成单元122生成了采样信号。The sampling signal generating unit 122 of the background processing module 12 generates the sampling signal.

后台处理模块12的通道切换信号生成单元123生成了通道切换信号。The channel switching signal generating unit 123 of the background processing module 12 generates the channel switching signal.

后台处理模块12的PWM通道选择单元124选择不同的PWM通道分别输出时钟信号、采样信号以及通道切换信号。The PWM channel selection unit 124 of the background processing module 12 selects different PWM channels to output clock signals, sampling signals and channel switching signals respectively.

实施例8Example 8

参见图8,图8为本发明模拟信号采样系统中模拟数字转换器实施例8的功能模块示意图。Referring to FIG. 8 , FIG. 8 is a schematic diagram of functional modules of Embodiment 8 of the analog-to-digital converter in the analog signal sampling system of the present invention.

在实施例8中,与上述实施例6的结构基本相同,不同之处在于,所述模拟数字转换器2包括模数转换器处理模块21、模数转换器通信模块22。In Embodiment 8, the structure is basically the same as that of Embodiment 6 above, except that the analog-to-digital converter 2 includes an analog-to-digital converter processing module 21 and an analog-to-digital converter communication module 22 .

所述模数转换器处理模块21,用于根据所述时钟信号和所述采样信号采集采样数据。The analog-to-digital converter processing module 21 is configured to collect sampling data according to the clock signal and the sampling signal.

所述模数转换器通信模块22,用于接收所述时钟信号、所述采样信号以及所述通道切换信号,以及用于发送所述采样数据至所述DMA控制器。The analog-to-digital converter communication module 22 is used for receiving the clock signal, the sampling signal and the channel switching signal, and for sending the sampling data to the DMA controller.

模数转换器通信模块22接收微处理发送的时钟信号、采样信号以及通道切换信号。The analog-to-digital converter communication module 22 receives the clock signal, sampling signal and channel switching signal sent by the microprocessor.

模拟数字转换器2的模数转换器处理模块21接收到时钟信号和采样信号后,启动采样数据的采集。After the analog-to-digital converter processing module 21 of the analog-to-digital converter 2 receives the clock signal and the sampling signal, it starts to collect the sampling data.

当采集到采集数据后,模数转换器处理模块21根据通道切换信号进行采样数据的传输。After collecting the collected data, the analog-to-digital converter processing module 21 transmits the sampled data according to the channel switching signal.

模数转换器通信模块22将采集数据通过SPI接口发送至DMA控制器。The analog-to-digital converter communication module 22 sends the collected data to the DMA controller through the SPI interface.

实施例9Example 9

参见图9,图9为本发明模拟信号采样系统中模拟数字转换器实施例9的功能模块示意图。Referring to FIG. 9 , FIG. 9 is a schematic diagram of functional modules of Embodiment 9 of the analog-to-digital converter in the analog signal sampling system of the present invention.

在实施例9中,与上述实施例6的结构基本相同,不同之处在于,所述DMA控制器3包括DMA控制器处理模块31和DMA控制器通信模块32。In Embodiment 9, the structure is basically the same as that of Embodiment 6 above, except that the DMA controller 3 includes a DMA controller processing module 31 and a DMA controller communication module 32 .

所述DMA控制器处理模块31,用于将所述采样数据存储至缓冲区,以及用于产生中断信号。The DMA controller processing module 31 is configured to store the sampling data into a buffer and generate an interrupt signal.

所述DMA控制器通信模块32,用于接收所述采样数据,以及发送中断信号至微处理器。The DMA controller communication module 32 is used for receiving the sampling data and sending an interrupt signal to the microprocessor.

DMA控制器通信模块32接收模拟数字转换器发送的采样数据,DMA控制器处理模块31将采样数据存储至缓冲区中。The DMA controller communication module 32 receives the sampling data sent by the analog-to-digital converter, and the DMA controller processing module 31 stores the sampling data into a buffer.

当缓冲区中存满该采样数据时,DMA控制器处理模块31生成中断信号。When the buffer is full of the sampling data, the DMA controller processing module 31 generates an interrupt signal.

DMA控制器通信模块32将该中断信号发送至微处理器。The DMA controller communication module 32 sends the interrupt signal to the microprocessor.

微处理器读取缓冲区中的采样数据,并对该采样数据进行分析计算处理。The microprocessor reads the sampled data in the buffer, and performs analysis and calculation on the sampled data.

以上对发明的具体实施方式进行了详细说明,但其只作为范例,本发明并不限制与以上描述的具体实施方式。对于本领域的技术人员而言,任何对该发明进行的等同修改或替代也都在本发明的范畴之中,因此,在不脱离本发明的精神和原则范围下所作的均等变换和修改、改进等,都应涵盖在本发明的范围内。The specific embodiments of the invention have been described in detail above, but they are only examples, and the present invention is not limited to the specific embodiments described above. For those skilled in the art, any equivalent modifications or substitutions to the invention are also within the scope of the present invention, therefore, equivalent transformations, modifications and improvements made without departing from the spirit and scope of the present invention etc., should be covered within the scope of the present invention.

Claims (8)

1.一种模拟信号采样方法,其特征在于,其包括如下步骤:1. an analog signal sampling method, is characterized in that, it comprises the steps: 微处理器进行初始化设置;The microprocessor carries out initialization setting; 所述微处理器产生硬件逻辑信号,并选择PWM通道输出硬件逻辑信号;The microprocessor generates a hardware logic signal, and selects a PWM channel to output the hardware logic signal; 模拟数字转换器接收到所述硬件逻辑信号后,所述模拟数字转换器采集采样数据,并将所述采样数据通过SPI接口发送至DMA控制器;After the analog-to-digital converter receives the hardware logic signal, the analog-to-digital converter collects sampling data, and sends the sampling data to the DMA controller through the SPI interface; 所述DMA控制器的缓冲区存满所述采样数据时,所述DMA控制器产生中断信号,并将所述中断信号和所述采样数据发送至所述微处理器;When the buffer of the DMA controller is full of the sampled data, the DMA controller generates an interrupt signal, and sends the interrupt signal and the sampled data to the microprocessor; 所述微处理器对所述采样数据进行分析计算处理;The microprocessor analyzes and calculates the sampling data; 所述微处理器进行初始化设置的步骤,包括:The steps for the microprocessor to initialize and set include: 所述微处理器获取所述模拟数字转换器的时序参数,并根据所述时序参数设置所述微处理器的PWM模块的输出频率和占空比;The microprocessor acquires timing parameters of the analog-to-digital converter, and sets the output frequency and duty cycle of the PWM module of the microprocessor according to the timing parameters; 所述微处理器设置所述SPI接口的参数;The microprocessor sets the parameters of the SPI interface; 所述微处理器设置所述DMA控制器的缓冲区的大小。The microprocessor sets the buffer size of the DMA controller. 2.根据权利要求1所述的模拟信号采样方法,其特征在于,所述微处理器产生硬件逻辑信号,并选择PWM通道输出硬件逻辑信号的步骤,包括:2. analog signal sampling method according to claim 1, is characterized in that, described microprocessor produces hardware logic signal, and selects the step of PWM channel output hardware logic signal, comprises: 所述微处理器产生时钟信号、采样信号以及通道切换信号;The microprocessor generates a clock signal, a sampling signal and a channel switching signal; 所述微处理器选择不同的所述PWM通道,并按照设置的所述输出频率和所述占空比分别输出所述时钟信号、所述采样信号以及所述通道切换信号。The microprocessor selects different PWM channels, and outputs the clock signal, the sampling signal and the channel switching signal respectively according to the set output frequency and the duty cycle. 3.根据权利要求2所述的模拟信号采样方法,其特征在于,所述模拟数字转换器接收到所述硬件逻辑信号后,所述模拟数字转换器采集采样数据,并将所述采样数据通过SPI接口发送至DMA控制器的步骤,包括:3. The analog signal sampling method according to claim 2, wherein after the analog-to-digital converter receives the hardware logic signal, the analog-to-digital converter collects sampling data, and passes the sampling data through The steps for sending the SPI interface to the DMA controller include: 所述模拟数字转换器接收通过不同PWM通道发送的所述时钟信号、所述采样信号以及所述通道切换信号;The analog-to-digital converter receives the clock signal, the sampling signal and the channel switching signal sent through different PWM channels; 所述模拟数字转换器根据所述时钟信号和所述采样信号采集所述采样数据;The analog-to-digital converter collects the sampling data according to the clock signal and the sampling signal; 所述模拟数字转换器根据所述通道切换信号将所述采样数据通过所述SPI接口发送至所述DMA控制器。The analog-to-digital converter sends the sampling data to the DMA controller through the SPI interface according to the channel switching signal. 4.根据权利要求1所述的模拟信号采样方法,其特征在于,所述微处理器对所述采样数据进行分析计算处理的步骤,包括:4. analog signal sampling method according to claim 1, is characterized in that, described microprocessor carries out the step of analyzing and calculating processing to described sampling data, comprises: 所述微处理器根据所述采样数据判断所述微处理器的PWM模块是否正常工作;The microprocessor judges whether the PWM module of the microprocessor is working normally according to the sampling data; 所述微处理器根据所述采样数据判断所述模拟数字转换器是否正常采集采样数据。The microprocessor judges whether the analog-to-digital converter collects sampled data normally according to the sampled data. 5.一种模拟信号采样系统,其特征在于,其包括微处理器、模拟数字转换器、DMA控制器,所述微处理器与所述模拟数字转换器通过PWM通道通信连接,所述模拟数字转换器与所述DMA控制器通过SPI接口通信连接,所述微处理器与所述DMA控制器之间通信连接,所述微处理器用于初始化设置、还用于产生硬件逻辑信号和选择PWM通道输出硬件逻辑信号、以及对采样数据进行分析计算处理;所述模拟数字转换器用于采集采样数据;所述DMA控制器用于存储采样数据以及产生中断信号;5. An analog signal sampling system is characterized in that it includes a microprocessor, an analog-to-digital converter, and a DMA controller, and the microprocessor and the analog-to-digital converter are connected through a PWM channel, and the analog-to-digital converter The converter communicates with the DMA controller through the SPI interface, and the microprocessor communicates with the DMA controller. The microprocessor is used for initializing settings, and also for generating hardware logic signals and selecting PWM channels. Output hardware logic signals, and analyze and calculate the sampled data; the analog-to-digital converter is used to collect the sampled data; the DMA controller is used to store the sampled data and generate an interrupt signal; 所述微处理器包括获取模块、后台处理模块、PWM模块、后台通信模块以及判断模块;The microprocessor includes an acquisition module, a background processing module, a PWM module, a background communication module and a judgment module; 所述获取模块,用于获取所述模拟数字转换器的时序参数;The acquiring module is configured to acquire timing parameters of the analog-to-digital converter; 所述后台处理模块,用于根据所述时序参数设置所述PWM模块的输出频率和占空比,还用于设置所述SPI接口的参数,还用于设置所述DMA控制器的缓冲区的大小,以及产生硬件逻辑信号和选择PWM通道;The background processing module is used to set the output frequency and duty cycle of the PWM module according to the timing parameters, is also used to set the parameters of the SPI interface, and is also used to set the buffer of the DMA controller size, as well as generating hardware logic signals and selecting PWM channels; 所述后台通信模块,用于发送所述硬件逻辑信号至模拟数字转换器;The background communication module is used to send the hardware logic signal to the analog-to-digital converter; 所述判断模块,用于根据所述采样数据判断所述PWM模块是否正常工作以及所述模拟数字转换器是否正常采集采样数据。The judging module is used for judging whether the PWM module works normally and whether the analog-to-digital converter collects sampling data normally according to the sampling data. 6.根据权利要求5所述的模拟信号采样系统,其特征在于,所述后台处理模块包括时钟信号生成单元、采样信号生成单元、通道切换信号生成单元、以及PWM通道选择单元;6. The analog signal sampling system according to claim 5, wherein the background processing module comprises a clock signal generating unit, a sampling signal generating unit, a channel switching signal generating unit, and a PWM channel selection unit; 所述时钟信号生成单元,用于生成时钟信号;The clock signal generating unit is configured to generate a clock signal; 所述采样信号生成单元,用于生成采样信号;The sampling signal generating unit is configured to generate a sampling signal; 所述通道切换信号生成单元,用于生成通道切换信号;The channel switching signal generating unit is configured to generate a channel switching signal; 所述PWM通道选择单元,用于根据时钟信号、采样信号或通道切换信号选择PWM通道。The PWM channel selection unit is used to select a PWM channel according to a clock signal, a sampling signal or a channel switching signal. 7.根据权利要求6所述的模拟信号采样系统,其特征在于,所述模拟数字转换器包括模数转换器处理模块、模数转换器通信模块;7. The analog signal sampling system according to claim 6, wherein the analog-to-digital converter comprises an analog-to-digital converter processing module and an analog-to-digital converter communication module; 所述模数转换器处理模块,用于根据所述时钟信号和所述采样信号采集采样数据;The analog-to-digital converter processing module is used to collect sampling data according to the clock signal and the sampling signal; 所述模数转换器通信模块,用于接收所述时钟信号、所述采样信号以及所述通道切换信号,以及用于发送所述采样数据至所述DMA控制器。The analog-to-digital converter communication module is used for receiving the clock signal, the sampling signal and the channel switching signal, and for sending the sampling data to the DMA controller. 8.根据权利要求5所述的模拟信号采样系统,其特征在于,所述DMA控制器包括DMA控制器处理模块和DMA控制器通信模块;8. analog signal sampling system according to claim 5, is characterized in that, described DMA controller comprises DMA controller processing module and DMA controller communication module; 所述DMA控制器处理模块,用于将所述采样数据存储至缓冲区,以及用于产生中断信号;The DMA controller processing module is used to store the sampling data into a buffer, and to generate an interrupt signal; 所述DMA控制器通信模块,用于接收所述采样数据,以及发送中断信号至微处理器。The DMA controller communication module is used to receive the sampling data and send an interrupt signal to the microprocessor.
CN201410800121.4A 2014-12-19 2014-12-19 The analog signal method of sampling and sampling system Active CN104570858B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201410800121.4A CN104570858B (en) 2014-12-19 2014-12-19 The analog signal method of sampling and sampling system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201410800121.4A CN104570858B (en) 2014-12-19 2014-12-19 The analog signal method of sampling and sampling system

Publications (2)

Publication Number Publication Date
CN104570858A CN104570858A (en) 2015-04-29
CN104570858B true CN104570858B (en) 2017-08-29

Family

ID=53087211

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201410800121.4A Active CN104570858B (en) 2014-12-19 2014-12-19 The analog signal method of sampling and sampling system

Country Status (1)

Country Link
CN (1) CN104570858B (en)

Families Citing this family (16)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2016183829A1 (en) * 2015-05-20 2016-11-24 深圳怡化电脑股份有限公司 Multiple-channel analog sensor-based sampling method and apparatus, and currency switcher
CN107437943B (en) * 2016-05-28 2021-08-31 深圳市京泉华科技股份有限公司 Analog-to-digital converter sampling system and analog-to-digital converter sampling method
CN108375756A (en) * 2018-01-09 2018-08-07 山东省科学院自动化研究所 A kind of direct sampling system of pulse radar radio frequency and method based on switch arrays
CN109739782B (en) * 2018-12-27 2020-10-30 国电南瑞科技股份有限公司 Continuous sampling method
CN112650049B (en) * 2019-10-11 2023-01-20 博世华域转向系统有限公司 System and method for signal acquisition and control output of electric power steering motor
CN111786865B (en) * 2020-06-09 2021-11-12 青岛信芯微电子科技股份有限公司 Data processing method and equipment
CN111988417B (en) * 2020-08-28 2022-07-19 电子科技大学 Communication control method of IoT terminal
CN112040601B (en) * 2020-09-03 2023-04-07 广州彩熠灯光股份有限公司 Lamp dot matrix control device and method, LED stage lamp
CN112946355A (en) * 2021-02-25 2021-06-11 云谷技术(珠海)有限公司 Power distribution terminal PWM analog sampling system and method
CN113031761B (en) * 2021-03-05 2023-06-23 西北工业大学 A high-speed synchronous sampling method of multi-sensor data for data gloves
CN113114254B (en) * 2021-05-18 2022-08-26 天津凯发电气股份有限公司 High-speed multi-channel synchronous analog quantity acquisition control method
CN113253651B (en) * 2021-05-20 2022-08-16 广州大学 Dynamic oversampling method and circuit for electrochemical signal acquisition
CN113835465B (en) * 2021-09-28 2024-02-02 北京维普无限智能技术有限公司 System and method for generating PWM (pulse Width modulation) signals and corresponding electronic equipment
CN114003375A (en) * 2021-09-30 2022-02-01 山东云海国创云计算装备产业创新中心有限公司 Chip sampling control method, device, system, equipment and storage medium
CN115078811A (en) * 2022-05-07 2022-09-20 深圳市科陆电子科技股份有限公司 ADC (analog to digital converter) AC/DC (alternating current/direct current) sampling method based on linux platform
CN115933495A (en) * 2022-12-28 2023-04-07 上海临港电力电子研究有限公司 Sampling multiplexing system and method for double-motor controller

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN2678250Y (en) * 2004-01-09 2005-02-09 李剑 PWM controller using DMA technology
CN1746838A (en) * 2005-10-17 2006-03-15 张金贵 Sampling method and system for multi-channel analog signal
US8072180B1 (en) * 2002-12-03 2011-12-06 Deka Products Limited Partnership Synchronous sampling of PWM waveforms
CN102495132A (en) * 2011-12-13 2012-06-13 东北大学 Multi-channel data acquisition device for submarine pipeline magnetic flux leakage internal detector
CN102664578A (en) * 2012-04-20 2012-09-12 电子科技大学 Distributed control system of diesel generators
CN103278203A (en) * 2013-04-25 2013-09-04 合肥工业大学 High frequency Coriolis mass flowmeter digital signal processing system

Family Cites Families (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7696912B2 (en) * 2008-05-02 2010-04-13 Exar Corporation Interrupt based multiplexed current limit circuit
CN101645054B (en) * 2009-08-25 2011-07-13 中兴通讯股份有限公司 Data acquisition card, extension control system and method thereof
CN101672700A (en) * 2009-09-27 2010-03-17 上海华魏光纤传感技术有限公司 Distributed temperature measuring A/D acquisition card based on FPGA and acquisition method thereof
US8502721B2 (en) * 2009-12-02 2013-08-06 Scaleo Chip Apparatus and methods thereof for reducing energy consumption for PWM controlled integrated circuits in vehicles
CN102694997A (en) * 2011-03-24 2012-09-26 张天飞 Design of general data collection and transmission board based on FPGA and camera link protocol-based interface
CN102736541B (en) * 2012-06-19 2015-01-07 北京航空航天大学 Device for acquiring rocket-borne data of solid-liquid power sounding rocket
US9047270B2 (en) * 2013-01-18 2015-06-02 Freescale Semiconductor Inc. DMA-assisted irregular sampling sequences
CN103744334A (en) * 2014-01-22 2014-04-23 浪潮电子信息产业股份有限公司 Data acquisition system based on field programmable gate array chip and Ethernet

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8072180B1 (en) * 2002-12-03 2011-12-06 Deka Products Limited Partnership Synchronous sampling of PWM waveforms
CN2678250Y (en) * 2004-01-09 2005-02-09 李剑 PWM controller using DMA technology
CN1746838A (en) * 2005-10-17 2006-03-15 张金贵 Sampling method and system for multi-channel analog signal
CN102495132A (en) * 2011-12-13 2012-06-13 东北大学 Multi-channel data acquisition device for submarine pipeline magnetic flux leakage internal detector
CN102664578A (en) * 2012-04-20 2012-09-12 电子科技大学 Distributed control system of diesel generators
CN103278203A (en) * 2013-04-25 2013-09-04 合肥工业大学 High frequency Coriolis mass flowmeter digital signal processing system

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
一种基于PWM原理的多路信号发生器;王小立;《电力系统保护与控制》;20070501;第35卷(第9期);全文 *
微机控制系统中PWM的实现;张运波;《电工技术》;20021231(第8期);全文 *

Also Published As

Publication number Publication date
CN104570858A (en) 2015-04-29

Similar Documents

Publication Publication Date Title
CN104570858B (en) The analog signal method of sampling and sampling system
CN104102181B (en) Intelligent home control method, device and system
CN102110053B (en) Random testing method based on Android
CN110958295B (en) Testing method and system based on vehicle-mounted ATP equipment
JP2015536690A5 (en)
CN104386094A (en) Method and device for generating rail transit station line diagram
CN104199569A (en) Keyboard and mouse switching and using method based on USB interfaces in KVM equipment
EP2733606A3 (en) Method for loading a process on an electronic device based on a user event
RU2012140027A (en) INFORMATION PROCESSING DEVICE, INFORMATION PROCESSING SYSTEM, INFORMATION PROCESSING METHOD AND INFORMATION MEDIA
CN106707248A (en) Software-based radar signal real-time processing system
CN104536681A (en) Method and system for simultaneously starting a plurality of applications on basis of touch screen
CN104323771A (en) Method and device for detecting P-wave and T-wave in electrocardiogram (ECG) signal
CN106326644B (en) A kind of computing device of heart rate variability parameter and fatigue strength index
CN103823781B (en) Downloading device for field-programmable gate array logical code
CN105095165A (en) Test analysis report generation method and test analysis report generation device
CN105298495B (en) Coal mining technology debugging method and device
CN106612084A (en) Current sampling processing circuit and current sampling processing method
CN106647435B (en) The multi-channel data method of sampling, system and device
CN104464254B (en) A kind of Distributed Data Synchronization harvester and method
CN103167078A (en) Automatic testing system and testing method of mobile phone
CN206773103U (en) Test the equipment and system of bandwidth
CN105629016A (en) Oscilloscope sampling and imaging system
JP2015172931A5 (en)
CN104539290A (en) Automatic data aligning system for multiple paths of A/D converters
CN104133136A (en) A turntable frequency response test device

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant