假定从8位AD中读取数据(如果是更高位的AD可定义数据类型为int),子程序为get_ad(); 1、限幅滤波法(又称程序判断滤波法) A、方法: 根据经验判断,确定两次采样允许的最大偏差值(设为A) 每次检测到新值时判断: 如果本次值与上次值之差<=A,则本次值有效 如果本次值与上次值之差>A,则本次值无效,放弃本次值,用上次值代替本次值 B、优点: 能有效克服因偶然因素引起的脉冲干扰 C、缺点 无法抑制那种周期性的干扰 平滑度差 /* A值可根据实际情况调整 Value为有效值,new_Value为当前采样值 滤波程序返回有效的实际值 */ #define A 10 char Value; char filter() { char new_Value; new_Value = get_ad(); if ( ( new_Value - Value > A ) || ( Value - new_Value > A ) return Value; return new_Value; } 2、中位值滤波法 A、方法: 连续采样N次(N取奇数) 把N次采样值按大小排列 取中间值为本次有效值 B、优点: 能有效克服因偶然因素引起的波动干扰 对温度、液位的变化缓慢的被测参数有良好的滤波效果 C、缺点: 对流量、速度等快速变化的参数不宜 /* N值可根据实际情况调整 排序采用冒泡法*/
上传时间: 2014-12-26
上传用户:nanshan
为提高电容测量精度,针对电容式传感器的工作原理设计了基于PIC16LF874单片机电容测量模块。简单阐述了电容测量电路的应用背景和国内外研究现状,介绍了美国Microchip公司PIC16LF874单片机的特性。电容式传感器输出的动态微弱电容信号通过PS021型电容数字转换器把模拟量数据转换成数字量数据,所测数据由PIC16LF874单片机应用程序进行处理、显示和保存。实验结果表明,固定电容标称值为10~20 pF 的测量值相对误差在1%以内,同时也可知被测电容容值越大,测量值和标称值相对误差越小。 Abstract: To improve the accuracy of capacitance measurement,aimed at the principle of work of mercury capacitance acceleration transducer,the design of micro capacitance measurement circuit is based on the key PIC16LF874 chip. Briefly discusses the application of the capacitance measuring circuit for the background and status of foreign researchers,focusing on the United States PIC16LF874 microcontroller features. Capacitive sensor outputed signal through the dynamics of weak PS021-chip capacitors (capacitancedigital converter) to convert analog data into digital data,the measured data from the PIC16LF874 microcontroller application process, display and preservation. Experimental results show that the fixed capacitor 10pF ~ 20pF nominal Value of the measured Value of relative error is within 1%,but also it canbe seen the Value of the measured capacitance larger,measuring Value and the nominal Value of relative error smaller.
上传时间: 2013-10-29
上传用户:wojiaohs
设计一种基于ATmega16L单片机的温度控制系统,阐述该系统的软硬件设计方案。采用模块化设计方法,利用增量式PID算法使被控对象的温度值趋于给定值。实验结果表明该系统具有良好的检测和控制功能。 Abstract: This paper designs a temperature control system based on ATmega16L,describes the hardware and software de-sign scheme of the system,adopts the modularized design method and utilizes the incremental PID algorithm to realize the temperature of controlled device incline to the given Value.The experiment result indicates that the system has good detec-tion and control function
上传时间: 2013-10-09
上传用户:stvnash
设计一种基于P89V51RD2的功率因数测量仪,采用光电隔离器和专用数码管驱动器。该测量仪是以增强型单片机P89V51RD2为核心,大大简化系统硬件设计。而软件部分采用模块化设计思想,采用中值滤波和小数补偿算法,实现功率因数的高精度测量。实验测试表明,该功率因数测量仪测量精度高,运行稳定可靠。 Abstract: A power-factor measurement instrument based on P89V51RD2is designed,which uses optical coupler and specific LED drive chip.The power factor measurement instrument uses P89V51RD2as a core of which greatly simplifies the system design.Furthermore,modularization software is developed in detail.The high precision power-factor measuring system is realized by the center Value filter and fractional compensation algorithm.Experiments manifests that the power- factor measurement instrument is high precision,steady and reliable.
上传时间: 2014-12-27
上传用户:CHINA526
实时时钟是微机保护装置的重要部件,在讨论PCF8583结构与功能的基础上,提出采用dsPIC33F系列微处理器与串行I2C时钟PCF8583的接口设计方案,给出了相应的接口电路与软件流程。该设计方案结构简单,可靠性高,开发周期短,具有一定的实用与参考价值。所设计的微机保护装置已投入现场运行,效果良好。 Abstract: Real-time clock chip is an important part in microcomputer protection device.Based on discussing the structure and function of PCF8583,a new interface scheme which uses dsPIC33F microprocessor and serial clock chip(I2C)PCF8583is proposed.The method of the circuit design and the main software flow are introduced in this paper.The scheme has simple structure,higher reliability and shorter exploitation cycle,so has definite practicality or reference Value.The microcomputer protection device has been put into operation with better effects.
上传时间: 2013-11-18
上传用户:Thuan
介绍了当前普通标记机控制系统现状及其存在缺点,给出气动标记机及相频修正PWM模式的工作原理。采用ATmega16单片机和USB转换RS232接口器件CH341T实现驱动控制系统与PC的实时通讯,标记控制系统可升级到USB接口。采用基于ATmega16的相频修正PWM替换555振荡电路产生的PWM,可直接通过软件调整PWM信号。使用达林顿三极管TIP122替代直流继电器驱动高频电磁阀,使得电磁阀驱动电路简单,成本低廉。该控制系统已成功应用于气动标记机。 Abstract: In this paper,the actuality and demerit of the common gas marking machine control systems are described.The operation principle of the gas marking machine and the phase and frequency correct PWM of ATmega16is introduced.The real-time communication between the driving control system and PC by CH341T which its function is translated USB to RS232is realized,the control systems is updated grade to USB interface.The PWM signal can be adjustable by software for the555surge circuit was substituted by the phase and frequency.The high frequency electromagnetic Value’s driving circuit by DC relay is replaced by TIP122,therefore,the circuit is become simple and the cost cheap.The control systems has been widely used in gas marking machine.
上传时间: 2013-10-18
上传用户:1427796291
采用单片机AT89C2051实现温度测量与控制,键盘和显示电路实现温度的设定、修改、清零以及当前温度值的显示,并对温度超过上下限进行报警。阐述了该系统设计的硬件和软件设计。 Abstract: The system of temperature measuring and controling is realized based on AT89C2051.The keyboard and display circuit is designed,which can be used for setting and modifying temperature Value,resetting and displaying the present temperature Value.At the same time the warning circuit is also designed in the system,which can deal with the alarm when temperature exceeds the upper limit and the lower limit.The hardware and software design of the system are explained.
上传时间: 2013-11-18
上传用户:leehom61
为了解决磁放大器性能测试过程中,需要对其供给不同数值恒定电流的问题,设计了一种基于DAC7512和单片机的数控恒流源系统。该系统采用AT89C51作为主控器件,将计算机发送的电流控制字命令转换为D/A转换器控制字,通过模拟SPI通信接口,写D/A控制字到DAC7512,从而控制其输出相应数字电压值,经差动缩放电路、电压/电路变换电路和功率驱动电路,最后输出恒定电流。实验结果表明,恒流源输出电流调节范围为-45~+45 mA、精度为±0.1 mA,分辨率达0.024 4 mA,具有应用灵活,外围电路简单,可靠性高的特点。该数控直流恒流源也可为相关产品的测试系统研发提供参考。 Abstract: In order to solve the need to supply different Values constant current for the magnetic amplifier in testing process, numerical control constant current source system was designed based on DAC7512 chip and microcontroller technology. The system used the AT89C51 as the main chip, which can convert the current control word from computer into to D/A control words. And the system wrote D/A control word into the DAC7512 chip to control the output voltage Value by the SPI communication interface, which can output corresponding constant current figures by scaling circuit, the V/I converter and power drive circuit. Experimental results show that the current source output current adjustment range is -45~+45mA, accuracy is ± 0.1mA, and resolution ratio is 0.024 4mA
上传时间: 2014-12-27
上传用户:invtnewer
提出一种基于单片机AT89C51SND1C的MP3播放系统的设计方案。单片机集成了专用的解码器,使用K9F1208闪存作为外存储器,放音电路采用CS4330,存储文件通过播放器上的USB接口设备从PC机上直接下载,液晶显示采用LCD1602。方案设计简单,性价比高,低功耗,易扩展。由于采用的是通用单片机实现的,可以很容易地移植到其他微控制器系统中,有很强的市场竞争能力和实用价值。 Abstract: A MP3 player design based on microchip AT89C51SND1C was presented, which used K9F1208 Flash chip as the memory circuit and used CS4330 as play chip. Storage files were download from PC through USB interfaces player on the device,and the LCD/602 was used as display screen. This system had characteristics of simple design,low power,easy expand,low cost and high recognition. Using of universual microchip make it easy to transplant to other microcontrol system,and have strong market competitiom and practical Value.
上传时间: 2014-12-27
上传用户:佳期如梦
The CAT823, CAT824, and CAT825 provide basic reset and monitoring functions for the electronic systems. Each device monitors the system voltage and maintains a reset output until that voltage reaches the device’s specified trip Value and then maintains the reset output active condition until the device’s internal timer, after a minimum timer of 140ms; toallow the systems power supply to stabilize.
上传时间: 2014-11-18
上传用户:BOBOniu