WO2016183829A1 - 一种基于多路模拟传感器的采样方法、装置及纸币切换器 - Google Patents

一种基于多路模拟传感器的采样方法、装置及纸币切换器 Download PDF

Info

Publication number
WO2016183829A1
WO2016183829A1 PCT/CN2015/079408 CN2015079408W WO2016183829A1 WO 2016183829 A1 WO2016183829 A1 WO 2016183829A1 CN 2015079408 W CN2015079408 W CN 2015079408W WO 2016183829 A1 WO2016183829 A1 WO 2016183829A1
Authority
WO
WIPO (PCT)
Prior art keywords
sampling
period
sampling period
data
sampled data
Prior art date
Application number
PCT/CN2015/079408
Other languages
English (en)
French (fr)
Inventor
胡钦惠
Original Assignee
深圳怡化电脑股份有限公司
深圳市怡化时代科技有限公司
深圳市怡化金融智能研究院
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 深圳怡化电脑股份有限公司, 深圳市怡化时代科技有限公司, 深圳市怡化金融智能研究院 filed Critical 深圳怡化电脑股份有限公司
Priority to PCT/CN2015/079408 priority Critical patent/WO2016183829A1/zh
Publication of WO2016183829A1 publication Critical patent/WO2016183829A1/zh

Links

Images

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
    • GPHYSICS
    • G07CHECKING-DEVICES
    • G07DHANDLING OF COINS OR VALUABLE PAPERS, e.g. TESTING, SORTING BY DENOMINATIONS, COUNTING, DISPENSING, CHANGING OR DEPOSITING
    • G07D7/00Testing specially adapted to determine the identity or genuineness of valuable papers or for segregating those which are unacceptable, e.g. banknotes that are alien to a currency

Definitions

  • the invention belongs to the field of electronics, and in particular relates to a sampling method, a device and a banknote switcher based on a multi-channel analog sensor.
  • the conventional automatic teller machine includes a pick-up unit that transfers the banknotes to and from the customer, a banknote counter that discriminates the currency and authenticity of the inserted banknotes, and a temporary storage section that temporarily retains the inserted banknotes.
  • the cassette for storing the banknotes, the modules are connected by the banknote transport passage, and the automatic teller machine transports the banknotes by means of the transport passage.
  • the cash automatic teller machine confirms the amount deposited by the customer, and then uses the money detector to re-identify the currency of the banknotes retained in the temporary storage unit, and stores them in the cash boxes according to the identified currency.
  • the multi-channel analog sensor in the banknote switcher detects the transfer of the banknotes, and detects the multi-channel analog sensor through the single-chip microcomputer.
  • the signal is sampled, and the result of the sampling is used to determine the direction of the banknote transfer.
  • the value of the analog touch sensor is usually sampled after the channel is switched.
  • the analog sensor is a slow process when the level changes, if the AD sampling is performed immediately after the channel switching is completed, This will cause the sampled value to be not a stable value, affecting the sampling efficiency and sampling accuracy, which in turn affects the performance of the banknote switcher.
  • An object of the embodiments of the present invention is to provide a sampling method based on a multi-channel analog sensor, which aims to solve the problem of low sampling efficiency and poor precision.
  • the embodiment of the present invention is implemented by a sampling method based on a multi-channel analog sensor, and the method includes the following steps:
  • sampling parameters including a single sampling period and a number of cyclic sampling times
  • sampling data After the starting point of the sampling data, performing DMA sampling processing on the multi-channel analog sensor according to the sampling parameter to obtain sampling data;
  • sampling data is subjected to sampling completion processing.
  • Another object of the embodiments of the present invention is to provide a sampling device based on a multi-channel analog sensor, the device comprising:
  • a rising period determining unit configured to determine a rising period of the multi-channel analog sensor, and using the rising period as a starting point of sampling data
  • a sampling parameter determining unit configured to determine a sampling parameter according to the rising period, where the sampling parameter includes a single sampling period and a number of cyclic sampling times;
  • a DMA sampling unit configured to perform DMA sampling processing on the multi-channel analog sensor according to the sampling parameter after the starting point of the sampling data, to acquire sampling data
  • the sampling completion processing unit is configured to perform sampling completion processing on the sampled data.
  • Another object of an embodiment of the present invention is to provide a bill switcher using the above-described multi-channel analog sensor-based sampling device.
  • the embodiment of the invention samples the sensor after the rising period, avoids the unstable phase of the sensor, ensures the consistency of the sampled data in the same hardware environment, improves the sampling precision, and can be configured differently when the sensor signal stability is different.
  • FIG. 1 is a flowchart of a sampling method based on a multi-channel analog sensor according to a first embodiment of the present invention
  • FIG. 2 is a graph showing changes in sampled values of a multi-channel analog sensor
  • FIG. 3 is a flowchart of a sampling method based on a multi-channel analog sensor according to a second embodiment of the present invention.
  • FIG. 4 is a flowchart of a method in step S203 in a sampling method based on a multi-channel analog sensor according to a second embodiment of the present invention
  • FIG. 5 is a structural diagram of a sampling device based on a multi-channel analog sensor according to an embodiment of the present invention.
  • the embodiment of the invention samples the sensor after the rising period, ensures the consistency of the sampled data, improves the sampling precision, and configures different sampling parameters when the sensor signal stability is different, and performs DMA sampling processing, after obtaining invalid sampling data, Reconfigure the storage address and start the next sampling, without delaying the software processing time, improving the sampling efficiency, and finally collecting the sampled data.
  • FIG. 1 shows a flow of a sampling method based on a multi-channel analog sensor according to a first embodiment of the present invention, and for convenience of explanation, only parts related to the present invention are shown.
  • the multi-channel analog sensor-based sampling method comprises the following steps:
  • step S101 determining a rising period of the multi-channel analog sensor, and using the rising period as a starting point of the sampling data;
  • determining the rising period of the multi-channel analog sensor means that the rising period of the multi-channel analog sensor should be clearly known before the setting of the software solution, and is used as the starting point of the data for subsequent sampling. It is generally considered that when the sampling value of the multi-channel analog sensor is no longer raised, the corresponding time is used as the rising period of the multi-channel analog sensor.
  • the X axis is represented as a time axis
  • the Y axis is a sample value of a multi-channel analog sensor.
  • the multi-channel analog sensor is The sampled value tends to be saturated and will no longer rise with time. Then, the corresponding time is 30ms, which is the rising period of the multi-channel analog sensor.
  • the sampled value 800 is the data when the multi-channel analog sensor is stable. What we want to guarantee in the sampling is to sample the data after 30ms.
  • a sampling parameter is determined according to a rising period, where the sampling parameter includes a single sampling period and a number of cyclic sampling times;
  • determining the single sampling period and the number of cyclic sampling is a pointer to the previous rising period of 30 ms, and configuring multiple sampling periods provided by the multiple analog sensors, and the configuration principle follows that at least two are performed in the rising period. Subsampling, the sampling cycle has the fewest number of cycles, and if there are multiple conditions that satisfy both of them, the time is short.
  • step S103 after sampling the data starting point, performing DMA sampling processing on the multi-channel analog sensor according to the sampling parameter to obtain sampling data;
  • the DMA sampling process mainly uses high-speed data transmission between the peripheral device and the memory, thereby saving the time for AD sampling.
  • step S104 the sampling data is subjected to sampling completion processing.
  • the sampling completion process mainly collects the sampled data, and determines the time point at which the next sampling starts.
  • the embodiment of the invention samples the sensor after the rising period, avoids the unstable phase of the sensor, ensures the consistency of the sampled data in the same hardware environment, improves the sampling precision, and can be configured differently when the sensor signal stability is different.
  • FIG. 3 shows a flow of a sampling method based on a multi-channel analog sensor according to a second embodiment of the present invention. For the convenience of description, only parts related to the present invention are shown.
  • the multi-channel analog sensor-based sampling method comprises the following steps:
  • step S201 determining a rising period of the multi-channel analog sensor, and using the rising period as sampling data starting point;
  • step S202 acquiring a sampling period set
  • step S203 the sampling period set is configured according to the rising period to determine a single sampling period
  • step S204 the number of cyclic samplings is determined according to the rising period and the single sampling period
  • the number of cyclic samples is obtained by dividing the rising period by a single sampling period.
  • step S205 after sampling the data starting point, performing DMA sampling processing on the multi-channel analog sensor according to the sampling parameter to obtain sampling data;
  • step S206 it is determined whether the sampled data is valid sampled data
  • step S207 the current storage address is changed to the initial address, and returns to step S205;
  • step S208 storing the sampling data, and updating the strobe signal
  • the strobe signal is used for the identification of the channel selection of the multi-channel sensor by the single chip microcomputer.
  • step S209 it is determined whether the sampled data is the last sample
  • step S210 acquiring (reading) the sampling data from the DMA storage module, and switching the channel;
  • the DMA sampling is set to a single sampling, and after each sampling ends, it is determined whether the current sampling data is valid sampling data, and if valid, the sampling data is stored and the strobe signal is updated; if it is invalid data, Then change the storage address of the sampled data to the original address and start the next data sample.
  • the sampled data is the last sampling, and the starting point of the next sampling data is still set to be the same as this time, and the first sampling data is discarded, and the second sampling data is taken as the actual sampling data.
  • the processing of the banknote switcher in each channel is equivalent to the above method, and the whole sampling is performed by DMA. After the invalid sampling data is acquired, the main need to reconfigure the storage address of the sampling result, and start the next sampling. Yes, there is no need to delay software processing time.
  • step S203 when the sensor signal stability is different, different sampling times can be configured, but only The last sampled data is dominant.
  • the steps of the configuration are as follows:
  • step S301 a sampling period conforming to the first configuration principle is filtered in the sampling period set to form a first set, and the first configuration principle is that at least two samplings can be performed in the rising period according to the sampling period;
  • step S302 it is determined whether the sampling period in the first set is multiple
  • step S303 is performed, and the sampling period in the first set is used as a single sampling period
  • step S304 is performed to filter the sampling period that meets the second configuration principle in the first set to form a second set, and the second configuration principle is a sampling period with the least number of cycles in the rising period;
  • step S305 it is determined whether the sampling period in the second set is multiple
  • step S306 is performed, and the sampling period in the second set is used as a single sampling period
  • step S307 is performed to filter the sampling period in accordance with the third configuration principle as a single sampling period in the second set, and the third configuration principle is the shortest sampling period.
  • sampling period provided by the MCU is 5ms, 8ms, 10ms, 14ms, 16ms, 18ms, 20ms, 25ms, following the first configuration principle that at least two samples can be sampled in the rising period, and the maximum period is 30ms in the rising period.
  • a sampling period of 15ms is required for a single cycle, so the range of the sampling period is reduced to 5ms, 8ms, 10ms, 14ms, and the second configuration principle of the sampling cycle with the least number of sampling cycles in the rising period is followed, and the sampling period is determined to be 10ms. 14ms, and finally follow the third configuration principle with the shortest sampling period, and determine the single sampling period as 10ms.
  • the embodiment of the invention samples the sensor after the rising period, avoids the unstable phase of the sensor, ensures the consistency of the sampled data in the same hardware environment, improves the sampling precision, and can be configured differently when the sensor signal stability is different.
  • FIG. 5 shows the structure of a multi-channel analog sensor-based sampling device according to an embodiment of the present invention. For the convenience of description, only parts related to the present invention are shown.
  • the multi-channel analog sensor-based sampling device includes:
  • the rising period determining unit 11 is configured to determine a rising period of the multi-channel analog sensor, and use the rising period as a starting point of the sampling data;
  • determining the rising period of the multi-channel analog sensor means that the rising period of the multi-channel analog sensor should be clearly known before the setting of the software solution, and is used as the starting point of the data for subsequent sampling. It is generally considered that when the sampling value of the multi-channel analog sensor is no longer raised, the corresponding time is used as the rising period of the multi-channel analog sensor.
  • the sampling parameter determining unit 12 is configured to determine sampling parameters according to the rising period, where the sampling parameters include a single sampling period and a number of cyclic sampling times;
  • determining the single sampling period and the number of cyclic sampling is a pointer to the previous rising period of 30 ms, and configuring multiple sampling periods provided by the multiple analog sensors, and the configuration principle follows that at least two are performed in the rising period. Subsampling, the sampling cycle has the fewest number of cycles, and if there are multiple conditions that satisfy both of them, the time is short.
  • the DMA sampling unit 13 is configured to perform DMA sampling processing on the multi-channel analog sensor according to the sampling parameter after the sampling data starting point, and acquire sampling data;
  • the DMA sampling process mainly uses high-speed data transmission between the peripheral device and the memory, thereby saving the time for AD sampling.
  • the sampling completion processing unit 14 is configured to perform sampling completion processing on the sampled data.
  • the sampling completion process mainly collects the sampled data, and determines the time point at which the next sampling starts.
  • the sampling parameter determining unit 12 includes:
  • An obtaining unit 121 configured to acquire a sampling period set
  • the single sampling period determining unit 122 is configured to configure the sampling period set according to the rising period to determine a single sampling period
  • the cyclic sampling number determining unit 123 is configured to determine the number of cyclic samplings according to the rising period and the single sampling period. Specifically, the number of cyclic samplings is obtained by dividing the rising period by a single sampling period.
  • the single sampling period determining unit 122 includes:
  • the first configuration module 1221 is configured to filter, in the sampling period set, a sampling period that conforms to the first configuration principle. Forming a first set, the first configuration principle is that at least two samplings can be performed in the rising period according to the sampling period;
  • the first judging module 1222 is configured to determine whether the sampling period in the first set is multiple, and when the sampling period in the first set is a single, the sampling period in the first set is used as a single sampling period;
  • the second configuration module 1223 is configured to: when the sampling period in the first set is multiple, filter the sampling period that meets the second configuration principle in the first set to form a second set, where the second configuration principle is in the rising period.
  • the sampling period with the least number of cycles;
  • the second judging module 1224 is configured to determine whether the sampling period in the second set is multiple, and when the sampling period in the second set is a single, the sampling period in the second set is used as a single sampling period;
  • the third configuration module 1225 is configured to: when the sampling period in the second set is multiple, select a sampling period that meets the third configuration principle in the second set as a single sampling period, and the third configuration principle is the shortest sampling time. cycle.
  • sampling period provided by the MCU is 5ms, 8ms, 10ms, 14ms, 16ms, 18ms, 20ms, 25ms, following the first configuration principle that at least two samples can be sampled in the rising period, and the maximum period is 30ms in the rising period.
  • a sampling period of 15ms is required for a single cycle, so the range of the sampling period is reduced to 5ms, 8ms, 10ms, 14ms, and the second configuration principle of the sampling cycle with the least number of sampling cycles in the rising period is followed, and the sampling period is determined to be 10ms. 14ms, and finally follow the third configuration principle with the shortest sampling period, and determine the single sampling period as 10ms.
  • the sampling completion processing unit 14 includes:
  • the effective determining module 141 is configured to determine whether the sampled data is valid sampling data
  • the change module 142 is configured to change the current storage address to an initial address when the sampled data is invalid sample data;
  • the storage module 143 is configured to store the sampled data when the sampled data is valid sampled data, and update the strobe signal to facilitate the identification of the channel selection of the multi-channel sensor by the single-chip microcomputer.
  • the sampling completion determining module 144 is configured to determine whether the sampling data is the last sampling
  • the switching module 145 is configured to acquire (read) the last sampled data from the DMA module, and switch the channel;
  • the DMA sampling is set to a single sampling, and after each sampling ends, it is determined whether the current sampling data is valid sampling data, and if valid, the sampling data is stored and the strobe signal is updated; if it is invalid data, Then change the storage address of the sampled data to the original address and start the next data sample.
  • the sampled data is the last sampling, and the starting point of the next sampling data is still set to be the same as this time, and the first sampling data is discarded, and the second sampling data is taken as the actual sampling data.
  • the processing of the banknote switcher in each channel is equivalent to the above method, and the whole sampling is performed by DMA. After the invalid sampling data is acquired, the main need to reconfigure the storage address of the sampling result, and start the next sampling. Yes, there is no need to delay software processing time.
  • Another object of an embodiment of the present invention is to provide a bill switcher using the above-described multi-channel analog sensor-based sampling device.
  • the embodiment of the invention samples the sensor after the rising period, avoids the unstable phase of the sensor, ensures the consistency of the sampled data in the same hardware environment, improves the sampling precision, and can be configured differently when the sensor signal stability is different.

Landscapes

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

Abstract

一种基于多路模拟传感器的采样方法、装置及纸币切换器,该方法包括:确定多路模拟传感器的上升周期,并将上升周期作为采样数据起点;根据上升周期确定采样参数,采样参数包括单次采样周期和循环采样次数;在采样数据起点之后,根据采样参数对多路模拟传感器进行DMA采样处理,获取采样数据;对采样数据进行采样完成处理。该方法在上升周期之后对传感器采样,保证采样数据的一致性,提高采样精度,并在传感器信号稳定性不同时配置不同的采样参数,进行DMA处理,在获取无效采样数据后,重新配置存放地址并启动下次采样,无需耽误软件处理时间,提高采样的效率,最后将采样完成的数据进行收拢。

Description

一种基于多路模拟传感器的采样方法、装置及纸币切换器 技术领域
本发明属于电子领域,尤其涉及一种基于多路模拟传感器的采样方法、装置及纸币切换器。
背景技术
目前,大多数银行均会设置现金自动存取款机为顾客提供自助存取款服务,用户可以在自动存取款机上存入纸币或取出纸币。那么,现有自动存取款机包括:与顾客之间进行纸币的授受的接客部、对投入的纸币的币种及真伪进行鉴别的验钞部、暂时保留所投入的纸币的暂存部以及保存纸币的钞箱,各个模块之间通过纸币传输通道连接,并且自动存取款机借助于传输通道来搬送纸币。
在存款交易中,如果顾客向接客部投入纸币,则所投入的纸币由验钞部鉴别,并将被鉴别为正常的纸币存放于暂存部,将被鉴别为不应交易的纸币返回接客部退还给顾客。之后,现金自动存取款机在确定顾客存入的金额后,利用验钞部再次鉴别在暂存部保留的纸币的币种,并根据鉴别的币种而保存于各钞箱。
然而,在纸币的传输过程中,常常需要通过纸币切换器来对纸币的传输方向进行切换,在纸币切换器中的多路模拟传感器对纸币的传输进行检测,并且通过单片机对多路模拟传感器检测到的信号进行采样,采样的结果用于纸币的传输方向切换判断。在单片机进行采样时,通常在通道切换的时候后即对模拟触感器的值进行采样获取,但由于模拟传感器在电平变化时是一个缓慢的过程,如果在通道切换完成后立即进行AD采样,会导致采样出来的值不是稳定值,影响采样效率和采样精度,进而影响纸币切换器的工作性能。
技术问题
本发明实施例的目的在于提供一种基于多路模拟传感器的采样方法,旨在解决现有采样效率低,精度差的问题。
问题的解决方案
技术解决方案
本发明实施例是这样实现的,一种基于多路模拟传感器的采样方法,所述方法包括下述步骤:
确定多路模拟传感器的上升周期,并将所述上升周期作为采样数据起点;
根据所述上升周期确定采样参数,所述采样参数包括单次采样周期和循环采样次数;
在所述采样数据起点之后,根据所述采样参数对多路模拟传感器进行DMA采样处理,获取采样数据;
对所述采样数据进行采样完成处理。
本发明实施例的另一目的在于,提供一种基于多路模拟传感器的采样装置,所述装置包括:
上升周期确定单元,用于确定多路模拟传感器的上升周期,并将所述上升周期作为采样数据起点;
采样参数确定单元,用于根据所述上升周期确定采样参数,所述采样参数包括单次采样周期和循环采样次数;
DMA采样单元,用于在所述采样数据起点之后,根据所述采样参数对多路模拟传感器进行DMA采样处理,获取采样数据;
采样完成处理单元,用于对所述采样数据进行采样完成处理。
本发明实施例的另一目的在于,提供一种采用上述基于多路模拟传感器的采样装置的纸币切换器。
发明的有益效果
有益效果
本发明实施例在上升周期之后对传感器采样,规避了传感器的不稳定阶段,能够保证在同等硬件环境下采样数据的一致性,提高采样的精度,并且在传感器信号稳定性不同时,可配置不同的采样参数,但只以最后一次的采样数据为准,然后根据采样参数进行DMA采样处理,在获取无效的采样数据后,重新配置采样结果的存放地址,并启动下次采样,无需耽误软件处理时间,提高采样的效率,最后将采样完成的数据进行收拢,同时确定下次采样开始的时间点。
对附图的简要说明
附图说明
图1为本发明第一实施例提供的基于多路模拟传感器的采样方法流程图;
图2为多路模拟传感器的采样值的变化曲线图;
图3为本发明第二实施例提供的基于多路模拟传感器的采样方法流程图;
图4为本发明第二实施例提供的基于多路模拟传感器的采样方法中步骤S203的方法流程图;
图5为本发明实施例提供的基于多路模拟传感器的采样装置的结构图。
发明实施例
本发明的实施方式
为了使本发明的目的、技术方案及优点更加清楚明白,以下结合附图及实施例,对本发明进行进一步详细说明。应当理解,此处所描述的具体实施例仅仅用以解释本发明,并不用于限定本发明。此外,下面所描述的本发明各个实施方式中所涉及到的技术特征只要彼此之间未构成冲突就可以相互组合。
本发明实施例在上升周期之后对传感器采样,保证了采样数据的一致性,提高采样精度,并在传感器信号稳定性不同时配置不同的采样参数,进行DMA采样处理,在获取无效采样数据后,重新配置存放地址并启动下次采样,无需耽误软件处理时间,提高采样的效率,最后将采样完成的数据进行收拢。
以下结合具体实施例对本发明的实现进行详细描述:
图1示出了本发明第一实施例提供的基于多路模拟传感器的采样方法流程,为了便于说明,仅示出了与本发明相关的部分。
作为本发明一实施例,该基于多路模拟传感器的采样方法包括下述步骤:
在步骤S101中,确定多路模拟传感器的上升周期,并将上升周期作为采样数据起点;
在本发明实施例中,确定多路模拟传感器的上升周期是指在软件方案设定之前,应该明确的知道多路模拟传感器的上升周期,并以此为后续采样的数据起点。一般认为当多路模拟传感器的采样值不再升高时,此时对应的时间作为多路模拟传感器的上升周期。
具体通过图2的曲线说明,在图2中,X轴表示为时间轴,Y轴为多路模拟传感器的采样值,从图2中可以看出,在A点的时候,多路模拟传感器的采样值趋于饱和,不再会随着时间的变化而升高,那么此时对应的时间30ms即为多路模拟传感器的上升周期,此时的采样值800为多路模拟传感器稳定时的数据,我们在采样中期望保证的就是采样到30ms以后的数据。
在步骤S102中,根据上升周期确定采样参数,该采样参数包括单次采样周期和循环采样次数;
在本发明实施例中,确定单次采样周期和循环采样次数是指针对前面的上升周期30ms,对多路模拟传感器提供的多个采样周期进行配置,配置的原则遵循在上升周期内最少进行两次采样,采样周期循环的次数最少,如果存在多个同时满足两者的条件,以时间短的为主。
在步骤S103中,在采样数据起点之后,根据采样参数对多路模拟传感器进行DMA采样处理,获取采样数据;
在本发明实施例中,DMA采样处理主要是通过外设与存储器之间的高速数据传输,节约AD采样的时间。
在步骤S104中,对采样数据进行采样完成处理。
在本发明实施例中,采样完成处理主要是为采样完成的数据进行收拢,同时确定下次采样开始的时间点。
本发明实施例在上升周期之后对传感器采样,规避了传感器的不稳定阶段,能够保证在同等硬件环境下采样数据的一致性,提高采样的精度,并且在传感器信号稳定性不同时,可配置不同的采样参数,但只以最后一次的采样数据为准,然后根据采样参数进行DMA采样处理,在获取无效的采样数据后,重新配置采样结果的存放地址,并启动下次采样,无需耽误软件处理时间,提高采样的效率,最后将采样完成的数据进行收拢,同时确定下次采样开始的时间点。
图3示出了本发明第二实施例提供的基于多路模拟传感器的采样方法流程,为了便于说明,仅示出了与本发明相关的部分。
作为本发明一实施例,该基于多路模拟传感器的采样方法包括下述步骤:
在步骤S201中,确定多路模拟传感器的上升周期,并将上升周期作为采样数据 起点;
在步骤S202中,获取采样周期集合;
在步骤S203中,根据上升周期对采样周期集合进行配置,以确定单次采样周期;
在步骤S204中,根据上升周期和单次采样周期确定循环采样次数;
作为本发明一实施例,循环采样次数通过将上升周期除以单次采样周期得到。
在步骤S205中,在采样数据起点之后,根据采样参数对多路模拟传感器进行DMA采样处理,获取采样数据;
在步骤S206中,判断采样数据是否为有效采样数据;
若否,则执行步骤在步骤S207,将当前存储地址更改为初始地址,并返回执行步骤S205;
若是,则执行步骤在步骤S208,存储采样数据,并更新选通信号;
在本发明实施例中,选通信号用于单片机对多路传感器的通道选择的识别。
在步骤S209中,判断采样数据是否为最后一次采样;
若是,则执行步骤在步骤S210,从DMA存储模块中获取(读取)采样数据,并切换通道;
若否,则返回执行步骤S209。
在本发明实施例中,将DMA采样设置为单次采样,在每次采样结束后,判断当前采样数据是否为有效采样数据,如果有效则存储采样数据并更新选通信号;如果为无效数据,则将采样数据的存储地址更改为最初的地址,并启动下次的数据采样。
然后判断采样数据是否为最后一次采样,将下一次的采样数据起点仍然设置为与本次相同,并将第一次的采样数据进行抛弃,将第二次的采样数据作为实际的采样数据。
纸币切换器在每个通道的处理都等同于上述的方式,整个采样都采用DMA的方式进行,在无效的采样数据获取后,主需要重新配置一下采样结果的存放地址,并启动下次采样即可,无需耽误软件处理时间。
对于步骤S203,在传感器信号稳定性不同时,可配置不同的采样次数,但只以 最后一次的采样数据为主,结合图4,该配置的步骤具体为:
在步骤S301中,在采样周期集合中筛选符合第一配置原则的采样周期,形成第一集合,第一配置原则为依据采样周期在上升周期内能进行至少两次采样;
在步骤S302中,判断第一集合中的采样周期是否为多个;
若否,则执行步骤S303,将第一集合中的采样周期作为单次采样周期;
若是,则执行步骤S304,在第一集合中筛选符合第二配置原则的采样周期,形成第二集合,第二配置原则为在上升周期内循环次数最少的采样周期;
在步骤S305中,判断第二集合中的采样周期是否为多个;
若否,则执行步骤S306,将第二集合中的采样周期作为单次采样周期;
若是,则执行步骤S307,在第二集合中筛选符合第三配置原则的采样周期作为单次采样周期,第三配置原则为时间最短的采样周期。
以下通过具体数值举例说明:
假设单片机能够提供的采样周期为5ms、8ms、10ms、14ms、16ms、18ms、20ms、25ms,遵循在上升周期中能进行至少两次采样的第一配置原则,在上升周期30ms的完整周期中最多需要单周期为15ms的采样周期,因此采样周期的范围缩小为5ms、8ms、10ms、14ms,再遵循在上升周期内采样周期循环次数最少的第二配置原则,将采样周期的范围确定为10ms、14ms,最后遵循采样周期的时间最短的第三配置原则,将单次采样周期确定为10ms。
在单次采样周期确定后,将上升周期30ms除以单次采样周期10ms,即可得到循环采样次数30/10=3。
本发明实施例在上升周期之后对传感器采样,规避了传感器的不稳定阶段,能够保证在同等硬件环境下采样数据的一致性,提高采样的精度,并且在传感器信号稳定性不同时,可配置不同的采样参数,但只以最后一次的采样数据为准,然后根据采样参数进行DMA采样处理,在获取无效的采样数据后,重新配置采样结果的存放地址,并启动下次采样,无需耽误软件处理时间,提高采样的效率,最后将采样完成的数据进行收拢,同时确定下次采样开始的时间点。
图5示出了本发明实施例提供的基于多路模拟传感器的采样装置的结构,为了便于说明,仅示出了与本发明相关的部分。
作为本发明一实施例,该基于多路模拟传感器的采样装置包括:
上升周期确定单元11,用于确定多路模拟传感器的上升周期,并将上升周期作为采样数据起点;
在本发明实施例中,确定多路模拟传感器的上升周期是指在软件方案设定之前,应该明确的知道多路模拟传感器的上升周期,并以此为后续采样的数据起点。一般认为当多路模拟传感器的采样值不再升高时,此时对应的时间作为多路模拟传感器的上升周期。
采样参数确定单元12,用于根据上升周期确定采样参数,采样参数包括单次采样周期和循环采样次数;
在本发明实施例中,确定单次采样周期和循环采样次数是指针对前面的上升周期30ms,对多路模拟传感器提供的多个采样周期进行配置,配置的原则遵循在上升周期内最少进行两次采样,采样周期循环的次数最少,如果存在多个同时满足两者的条件,以时间短的为主。
DMA采样单元13,用于在采样数据起点之后,根据采样参数对多路模拟传感器进行DMA采样处理,获取采样数据;
在本发明实施例中,DMA采样处理主要是通过外设与存储器之间的高速数据传输,节约AD采样的时间。
采样完成处理单元14,用于对采样数据进行采样完成处理。
在本发明实施例中,采样完成处理主要是为采样完成的数据进行收拢,同时确定下次采样开始的时间点。
作为本发明一实施例,采样参数确定单元12包括:
获取单元121,用于获取采样周期集合;
单次采样周期确定单元122,用于根据上升周期对采样周期集合进行配置,以确定单次采样周期;
循环采样次数确定单元123,用于根据上升周期和单次采样周期确定循环采样次数,具体地,循环采样次数通过将上升周期除以单次采样周期得到。
优选地,单次采样周期确定单元122包括:
第一配置模块1221,用于在采样周期集合中筛选符合第一配置原则的采样周期 ,形成第一集合,第一配置原则为依据采样周期在上升周期内能进行至少两次采样;
第一判断模块1222,用于判断第一集合中的采样周期是否为多个,并在第一集合中的采样周期为单个时,将第一集合中的采样周期作为单次采样周期;
第二配置模块1223,用于在第一集合中的采样周期为多个时,在第一集合中筛选符合第二配置原则的采样周期,形成第二集合,第二配置原则为在上升周期内循环次数最少的采样周期;
第二判断模块1224,用于判断第二集合中的采样周期是否为多个,并在第二集合中的采样周期为单个时,将第二集合中的采样周期作为单次采样周期;
第三配置模块1225,用于在第二集合中的采样周期为多个时,在第二集合中筛选符合第三配置原则的采样周期作为单次采样周期,第三配置原则为时间最短的采样周期。
在本发明实施例中,通过具体数值举例说明:
假设单片机能够提供的采样周期为5ms、8ms、10ms、14ms、16ms、18ms、20ms、25ms,遵循在上升周期中能进行至少两次采样的第一配置原则,在上升周期30ms的完整周期中最多需要单周期为15ms的采样周期,因此采样周期的范围缩小为5ms、8ms、10ms、14ms,再遵循在上升周期内采样周期循环次数最少的第二配置原则,将采样周期的范围确定为10ms、14ms,最后遵循采样周期的时间最短的第三配置原则,将单次采样周期确定为10ms。
在单次采样周期确定后,将上升周期30ms除以单次采样周期10ms,即可得到循环采样次数30/10=3。
作为本发明一实施例,采样完成处理单元14包括:
有效判断模块141,用于判断采样数据是否为有效采样数据;
更改模块142,用于当采样数据为无效采样数据时,将当前存储地址更改为初始地址;
存储模块143,用于当采样数据为有效采样数据时,存储采样数据,并更新选通信号,以便于单片机对多路传感器的通道选择的识别。
采样完成判断模块144,用于判断采样数据是否为最后一次采样;
切换模块145,用于从DMA模块中获取(读取)最后一次采样数据,并切换通道;
在本发明实施例中,将DMA采样设置为单次采样,在每次采样结束后,判断当前采样数据是否为有效采样数据,如果有效则存储采样数据并更新选通信号;如果为无效数据,则将采样数据的存储地址更改为最初的地址,并启动下次的数据采样。
然后判断采样数据是否为最后一次采样,将下一次的采样数据起点仍然设置为与本次相同,并将第一次的采样数据进行抛弃,将第二次的采样数据作为实际的采样数据。
纸币切换器在每个通道的处理都等同于上述的方式,整个采样都采用DMA的方式进行,在无效的采样数据获取后,主需要重新配置一下采样结果的存放地址,并启动下次采样即可,无需耽误软件处理时间。
本发明实施例的另一目的在于,提供一种采用上述基于多路模拟传感器的采样装置的纸币切换器。
本发明实施例在上升周期之后对传感器采样,规避了传感器的不稳定阶段,能够保证在同等硬件环境下采样数据的一致性,提高采样的精度,并且在传感器信号稳定性不同时,可配置不同的采样参数,但只以最后一次的采样数据为准,然后根据采样参数进行DMA采样处理,在获取无效的采样数据后,重新配置采样结果的存放地址,并启动下次采样,无需耽误软件处理时间,提高采样的效率,最后将采样完成的数据进行收拢,同时确定下次采样开始的时间点。
以上仅为本发明的较佳实施例而已,并不用以限制本发明,凡在本发明的精神和原则之内所作的任何修改、等同替换和改进等,均应包含在本发明的保护范围之内。

Claims (11)

  1. 一种基于多路模拟传感器的采样方法,其特征在于,所述方法包括下述步骤:
    确定多路模拟传感器的上升周期,并将所述上升周期作为采样数据起点;
    根据所述上升周期确定采样参数,所述采样参数包括单次采样周期和循环采样次数;
    在所述采样数据起点之后,根据所述采样参数对多路模拟传感器进行DMA采样处理,获取采样数据;
    对所述采样数据进行采样完成处理。
  2. 如权利要求1所述的方法,其特征在于,所述根据所述上升周期确定采样参数,所述采样参数包括单次采样周期和循环采样次数的步骤具体为:
    获取多路模拟传感器提供的采样周期集合;
    根据所述上升周期对所述采样周期集合进行配置,以确定单次采样周期;
    根据所述上升周期和所述单次采样周期确定循环采样次数。
  3. 如权利要求2所述的方法,其特征在于,所述配置的步骤具体为:在所述采样周期集合中筛选符合第一配置原则的采样周期,形成第一集合,所述第一配置原则为依据采样周期在所述上升周期内能进行至少两次采样;
    判断所述第一集合中的采样周期是否为多个;
    若否,则所述第一集合中的采样周期作为单次采样周期;
    若是,则在第一集合中筛选符合第二配置原则的采样周期,形成第二集合,所述第二配置原则为在所述上升周期内循环次数最少的采样周期;
    判断所述第二集合中的采样周期是否为多个;
    若否,则所述第二集合中的采样周期作为单次采样周期;
    若是,则在第二集合中筛选符合第三配置原则的采样周期作为单次采样周期,所述第三配置原则为时间最短的采样周期。
  4. 如权利要求2所述的方法,其特征在于,所述循环采样次数通过将所述上升周期除以所述单次采样周期得到。
  5. 如权利要求1所述的方法,其特征在于,所述对所述采样数据进行采样完成处理的步骤具体为:
    判断所述采样数据是否为有效采样数据;
    若否,则将当前存储地址更改为初始地址,并返回执行所述在所述采样数据起点之后,根据所述采样参数对多路模拟传感器进行DMA采样处理,获取采样数据的步骤;
    若是,则存储所述采样数据,并更新选通信号。
    判断所述采样数据是否为最后一次采样;
    若是,则获取所述采样数据,并切换通道;
    若否,则返回执行所述判断所述采样数据是否为最后一次采样的步骤。
  6. 一种基于多路模拟传感器的采样装置,其特征在于,所述装置包括:
    上升周期确定单元,用于确定多路模拟传感器的上升周期,并将所述上升周期作为采样数据起点;
    采样参数确定单元,用于根据所述上升周期确定采样参数,所述采样参数包括单次采样周期和循环采样次数;
    DMA采样单元,用于在所述采样数据起点之后,根据所述采样参数对多路模拟传感器进行DMA采样处理,获取采样数据;
    采样完成处理单元,用于对所述采样数据进行采样完成处理。
  7. 如权利要求6所述的装置,其特征在于,所述采样参数确定单元包括:
    获取单元,用于获取多路模拟传感器提供的采样周期集合;
    单次采样周期确定单元,用于根据所述上升周期对所述采样周期 集合进行配置,以确定单次采样周期;
    循环采样次数确定单元,用于根据所述上升周期和所述单次采样周期确定循环采样次数。
  8. 如权利要求6所述的装置,其特征在于,所述单次采样周期确定单元包括:
    第一配置模块,用于在所述采样周期集合中筛选符合第一配置原则的采样周期,形成第一集合,所述第一配置原则为依据采样周期在所述上升周期内能进行至少两次采样;
    第一判断模块,用于判断所述第一集合中的采样周期是否为多个,并在所述第一集合中的采样周期为单个时,将所述第一集合中的采样周期作为单次采样周期;
    第二配置模块,用于在所述第一集合中的采样周期为多个时,在第一集合中筛选符合第二配置原则的采样周期,形成第二集合,所述第二配置原则为在所述上升周期内循环次数最少的采样周期;
    第二判断模块,用于判断所述第二集合中的采样周期是否为多个,并在所述第二集合中的采样周期为单个时,将所述第二集合中的采样周期作为单次采样周期;
    第三配置模块,用于在所述第二集合中的采样周期为多个时,在第二集合中筛选符合第三配置原则的采样周期作为单次采样周期,所述第三配置原则为时间最短的采样周期。
  9. 如权利要求6所述的装置,其特征在于,所述循环采样次数通过将所述上升周期除以所述单次采样周期得到。
  10. 如权利要求6所述的装置,其特征在于,所述采样完成处理单元包括:
    有效判断模块,用于判断所述采样数据是否为有效采样数据;
    更改模块,用于当所述采样数据为无效采样数据时,将当前存储地址更改为初始地址;
    存储模块,用于当所述采样数据为有效采样数据时,存储所述采样数据,并更新选通信号;
    采样完成判断模块,用于判断所述采样数据是否为最后一次采样;
    切换模块,用于获取最后一次采样数据,并切换通道;
  11. 一种纸币切换器,其特征在于,所述纸币切换器包括如权利要求6至10任一项所述的基于多路模拟传感器的装置。
PCT/CN2015/079408 2015-05-20 2015-05-20 一种基于多路模拟传感器的采样方法、装置及纸币切换器 WO2016183829A1 (zh)

Priority Applications (1)

Application Number Priority Date Filing Date Title
PCT/CN2015/079408 WO2016183829A1 (zh) 2015-05-20 2015-05-20 一种基于多路模拟传感器的采样方法、装置及纸币切换器

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2015/079408 WO2016183829A1 (zh) 2015-05-20 2015-05-20 一种基于多路模拟传感器的采样方法、装置及纸币切换器

Publications (1)

Publication Number Publication Date
WO2016183829A1 true WO2016183829A1 (zh) 2016-11-24

Family

ID=57319195

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2015/079408 WO2016183829A1 (zh) 2015-05-20 2015-05-20 一种基于多路模拟传感器的采样方法、装置及纸币切换器

Country Status (1)

Country Link
WO (1) WO2016183829A1 (zh)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH0916273A (ja) * 1995-06-30 1997-01-17 Mitsutoyo Corp 温度制御装置
WO2014136230A1 (ja) * 2013-03-06 2014-09-12 株式会社日立製作所 分散型制御装置及び制御方法
CN104503931A (zh) * 2014-11-28 2015-04-08 上海富山精密机械科技有限公司 一种多路模拟信号采集方法
CN104570858A (zh) * 2014-12-19 2015-04-29 深圳市科陆电子科技股份有限公司 模拟信号采样方法以及采样系统

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH0916273A (ja) * 1995-06-30 1997-01-17 Mitsutoyo Corp 温度制御装置
WO2014136230A1 (ja) * 2013-03-06 2014-09-12 株式会社日立製作所 分散型制御装置及び制御方法
CN104503931A (zh) * 2014-11-28 2015-04-08 上海富山精密机械科技有限公司 一种多路模拟信号采集方法
CN104570858A (zh) * 2014-12-19 2015-04-29 深圳市科陆电子科技股份有限公司 模拟信号采样方法以及采样系统

Similar Documents

Publication Publication Date Title
CN102184267B (zh) 一种自动数据采集系统消除干扰的异常数据过滤方法
US4749074A (en) Coin sorting apparatus with reference value correction system
CN106294824B (zh) 制造物联网面向不确定数据流的复杂事件检测方法及系统
CN107862402A (zh) 一种业务处理方法及终端设备
CN105677593A (zh) 芯片存储器写操作时序路径自适应调节方法及装置
CN108900941A (zh) 耳机的音量控制方法及装置
WO2016183829A1 (zh) 一种基于多路模拟传感器的采样方法、装置及纸币切换器
CN107454950A (zh) 检测触摸点的方法和触摸控制器
CN109858638A (zh) 构建设备能效曲线的方法、装置、可读介质及电子设备
US8844808B2 (en) Cash till load cell
CN117196931A (zh) 面向传感器阵列的数据处理方法、fpga及电子设备
CN107274545B (zh) 验钞控制方法、验钞控制装置及存取款设备
Fang Analysing the variation tendencies of the numbers of yearly citations for sleeping beauties in science by using derivative analysis
JP6318969B2 (ja) 現金処理装置
CN107990929A (zh) 滤波时间常数的控制方法及装置、计算机装置、存储介质
CN108742415B (zh) 进水控制方法、抽屉式洗碗机及计算机可读存储介质
CN107894869A (zh) 一种分屏处理的方法、终端设备及计算机可读介质
CN104573134B (zh) 数据采集方法和数据采集设备
CN109857973A (zh) 红外数据滤波方法及装置
CN108470404B (zh) 用于读卡器的闸门控制方法、装置、金融设备及存储介质
US6223878B1 (en) Method and apparatus for validating coins
CN116961621B (zh) 一种可动态调整计算速度的fir滤波器
CN104680644A (zh) 纸币处理装置及其控制方法
CN109556643A (zh) 用于输出传感器数据的传感器系统
CN108648330A (zh) 存取款管理方法、存取款管理装置及自助终端

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 15892208

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 15892208

Country of ref document: EP

Kind code of ref document: A1