假定從8位AD中讀取數(shù)據(jù)(如果是更高位的AD可定義數(shù)據(jù)類(lèi)型為int),子程序?yàn)間et_ad(); 1、限幅濾波法(又稱(chēng)程序判斷濾波法) A、方法: 根據(jù)經(jīng)驗(yàn)判斷,確定兩次采樣允許的最大偏差值(設(shè)為A) 每次檢測(cè)到新值時(shí)判斷: 如果本次值與上次值之差<=A,則本次值有效 如果本次值與上次值之差>A,則本次值無(wú)效,放棄本次值,用上次值代替本次值 B、優(yōu)點(diǎn): 能有效克服因偶然因素引起的脈沖干擾 C、缺點(diǎn) 無(wú)法抑制那種周期性的干擾 平滑度差 /* A值可根據(jù)實(shí)際情況調(diào)整 value為有效值,new_value為當(dāng)前采樣值 濾波程序返回有效的實(shí)際值 */ #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、方法: 連續(xù)采樣N次(N取奇數(shù)) 把N次采樣值按大小排列 取中間值為本次有效值 B、優(yōu)點(diǎn): 能有效克服因偶然因素引起的波動(dòng)干擾 對(duì)溫度、液位的變化緩慢的被測(cè)參數(shù)有良好的濾波效果 C、缺點(diǎn): 對(duì)流量、速度等快速變化的參數(shù)不宜 /* N值可根據(jù)實(shí)際情況調(diào)整 排序采用冒泡法*/
上傳時(shí)間: 2014-12-26
上傳用戶:nanshan
為提高電容測(cè)量精度,針對(duì)電容式傳感器的工作原理設(shè)計(jì)了基于PIC16LF874單片機(jī)電容測(cè)量模塊。簡(jiǎn)單闡述了電容測(cè)量電路的應(yīng)用背景和國(guó)內(nèi)外研究現(xiàn)狀,介紹了美國(guó)Microchip公司PIC16LF874單片機(jī)的特性。電容式傳感器輸出的動(dòng)態(tài)微弱電容信號(hào)通過(guò)PS021型電容數(shù)字轉(zhuǎn)換器把模擬量數(shù)據(jù)轉(zhuǎn)換成數(shù)字量數(shù)據(jù),所測(cè)數(shù)據(jù)由PIC16LF874單片機(jī)應(yīng)用程序進(jìn)行處理、顯示和保存。實(shí)驗(yàn)結(jié)果表明,固定電容標(biāo)稱(chēng)值為10~20 pF 的測(cè)量值相對(duì)誤差在1%以內(nèi),同時(shí)也可知被測(cè)電容容值越大,測(cè)量值和標(biāo)稱(chēng)值相對(duì)誤差越小。 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.
上傳時(shí)間: 2013-10-29
上傳用戶:wojiaohs
設(shè)計(jì)一種基于ATmega16L單片機(jī)的溫度控制系統(tǒng),闡述該系統(tǒng)的軟硬件設(shè)計(jì)方案。采用模塊化設(shè)計(jì)方法,利用增量式PID算法使被控對(duì)象的溫度值趨于給定值。實(shí)驗(yàn)結(jié)果表明該系統(tǒng)具有良好的檢測(cè)和控制功能。 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
標(biāo)簽: ATmega 16L 16 單片機(jī)
上傳時(shí)間: 2013-10-09
上傳用戶:stvnash
設(shè)計(jì)一種基于P89V51RD2的功率因數(shù)測(cè)量?jī)x,采用光電隔離器和專(zhuān)用數(shù)碼管驅(qū)動(dòng)器。該測(cè)量?jī)x是以增強(qiáng)型單片機(jī)P89V51RD2為核心,大大簡(jiǎn)化系統(tǒng)硬件設(shè)計(jì)。而軟件部分采用模塊化設(shè)計(jì)思想,采用中值濾波和小數(shù)補(bǔ)償算法,實(shí)現(xiàn)功率因數(shù)的高精度測(cè)量。實(shí)驗(yàn)測(cè)試表明,該功率因數(shù)測(cè)量?jī)x測(cè)量精度高,運(yùn)行穩(wěn)定可靠。 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.
上傳時(shí)間: 2014-12-27
上傳用戶:CHINA526
實(shí)時(shí)時(shí)鐘是微機(jī)保護(hù)裝置的重要部件,在討論P(yáng)CF8583結(jié)構(gòu)與功能的基礎(chǔ)上,提出采用dsPIC33F系列微處理器與串行I2C時(shí)鐘PCF8583的接口設(shè)計(jì)方案,給出了相應(yīng)的接口電路與軟件流程。該設(shè)計(jì)方案結(jié)構(gòu)簡(jiǎn)單,可靠性高,開(kāi)發(fā)周期短,具有一定的實(shí)用與參考價(jià)值。所設(shè)計(jì)的微機(jī)保護(hù)裝置已投入現(xiàn)場(chǎng)運(yùn)行,效果良好。 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.
標(biāo)簽: 8583 PCF 串行時(shí)鐘 中的應(yīng)用
上傳時(shí)間: 2013-11-18
上傳用戶:Thuan
介紹了當(dāng)前普通標(biāo)記機(jī)控制系統(tǒng)現(xiàn)狀及其存在缺點(diǎn),給出氣動(dòng)標(biāo)記機(jī)及相頻修正PWM模式的工作原理。采用ATmega16單片機(jī)和USB轉(zhuǎn)換RS232接口器件CH341T實(shí)現(xiàn)驅(qū)動(dòng)控制系統(tǒng)與PC的實(shí)時(shí)通訊,標(biāo)記控制系統(tǒng)可升級(jí)到USB接口。采用基于ATmega16的相頻修正PWM替換555振蕩電路產(chǎn)生的PWM,可直接通過(guò)軟件調(diào)整PWM信號(hào)。使用達(dá)林頓三極管TIP122替代直流繼電器驅(qū)動(dòng)高頻電磁閥,使得電磁閥驅(qū)動(dòng)電路簡(jiǎn)單,成本低廉。該控制系統(tǒng)已成功應(yīng)用于氣動(dòng)標(biāo)記機(jī)。 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.
標(biāo)簽: ATmega 16 標(biāo)記 控制系統(tǒng)
上傳時(shí)間: 2013-10-18
上傳用戶:1427796291
采用單片機(jī)AT89C2051實(shí)現(xiàn)溫度測(cè)量與控制,鍵盤(pán)和顯示電路實(shí)現(xiàn)溫度的設(shè)定、修改、清零以及當(dāng)前溫度值的顯示,并對(duì)溫度超過(guò)上下限進(jìn)行報(bào)警。闡述了該系統(tǒng)設(shè)計(jì)的硬件和軟件設(shè)計(jì)。 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.
上傳時(shí)間: 2013-11-18
上傳用戶:leehom61
為了解決磁放大器性能測(cè)試過(guò)程中,需要對(duì)其供給不同數(shù)值恒定電流的問(wèn)題,設(shè)計(jì)了一種基于DAC7512和單片機(jī)的數(shù)控恒流源系統(tǒng)。該系統(tǒng)采用AT89C51作為主控器件,將計(jì)算機(jī)發(fā)送的電流控制字命令轉(zhuǎn)換為D/A轉(zhuǎn)換器控制字,通過(guò)模擬SPI通信接口,寫(xiě)D/A控制字到DAC7512,從而控制其輸出相應(yīng)數(shù)字電壓值,經(jīng)差動(dòng)縮放電路、電壓/電路變換電路和功率驅(qū)動(dòng)電路,最后輸出恒定電流。實(shí)驗(yàn)結(jié)果表明,恒流源輸出電流調(diào)節(jié)范圍為-45~+45 mA、精度為±0.1 mA,分辨率達(dá)0.024 4 mA,具有應(yīng)用靈活,外圍電路簡(jiǎn)單,可靠性高的特點(diǎn)。該數(shù)控直流恒流源也可為相關(guān)產(chǎn)品的測(cè)試系統(tǒng)研發(fā)提供參考。 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
標(biāo)簽: 7512 DAC 數(shù)控直流 恒流源
上傳時(shí)間: 2014-12-27
上傳用戶:invtnewer
提出一種基于單片機(jī)AT89C51SND1C的MP3播放系統(tǒng)的設(shè)計(jì)方案。單片機(jī)集成了專(zhuān)用的解碼器,使用K9F1208閃存作為外存儲(chǔ)器,放音電路采用CS4330,存儲(chǔ)文件通過(guò)播放器上的USB接口設(shè)備從PC機(jī)上直接下載,液晶顯示采用LCD1602。方案設(shè)計(jì)簡(jiǎn)單,性價(jià)比高,低功耗,易擴(kuò)展。由于采用的是通用單片機(jī)實(shí)現(xiàn)的,可以很容易地移植到其他微控制器系統(tǒng)中,有很強(qiáng)的市場(chǎng)競(jìng)爭(zhēng)能力和實(shí)用價(jià)值。 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.
上傳時(shí)間: 2014-12-27
上傳用戶:佳期如夢(mèng)
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.
上傳時(shí)間: 2014-11-18
上傳用戶:BOBOniu
蟲(chóng)蟲(chóng)下載站版權(quán)所有 京ICP備2021023401號(hào)-1