溫濕度傳感器 sht11 仿真程序 sbit out =P3^0; //加熱口 //sbit input =P1^1;//檢測口 //sbit speek =P2^0;//報警 sbit clo =P3^7;//時鐘 sbit ST =P3^5;//開始 sbit EOC =P3^6;//成功信號 sbit gwei =P3^4;//個位 sbit swei =P3^3;//十位 sbit bwei =P3^2;//百位 sbit qwei =P3^1;//千位 sbit speak =P0^0;//報警音 sbit bjled =P0^1;//報警燈 sbit zcled =P0^2;//正常LED int count; uchar xianzhi;//取轉換結果 uchar seth;//高時間 uchar setl;//低時間 uchar seth_mi;//高時間 uchar setl_mi;//低時間 bit hlbz;//高低標志 bit clbz; bit spbz; ///定時中斷程序/// void t0 (void) interrupt 1 using 0 { TH0=(65536-200)/256;//5ms*200=1000ms=1s TL0=(65536-200)%256; clo=!clo;//產生時鐘 if(count>5000) { if(hlbz) { if(seth_mi==0){seth_mi=seth;hlbz=0;out=0;} else seth_mi--; } if(!hlbz) { if(setl_mi==0){setl_mi=setl;hlbz=1;out=1;} else setl_mi--; } count=0; } else count++; } ///////////// ///////延時/////// delay(int i) { while(--i); } ///////顯示處理/////// xianshi() { int abcd=0; int i; for (i=0;i<5;i++) { abcd=xianzhi; gwei=1; swei=1; bwei=1; qwei=1; P1=dispcode[abcd/1000]; qwei=0; delay(70); qwei=1; abcd=abcd%1000; P1=dispcode[abcd/100]; bwei=0; delay(70); bwei=1; abcd=abcd%100; P1=dispcode[abcd/10]; swei=0; delay(70); swei=1; abcd=abcd%10; P1=dispcode[abcd]; gwei=0; delay(70); gwei=1; } } doing() { if(xianzhi>100) {bjled=0;speak=1;zcled=1;} else {bjled=1;speak=0;zcled=0;} } void main(void) { seth=60;//h60秒 setl=90;//l90秒 seth_mi=60;//h60秒 setl_mi=90;//l90秒 TMOD=0X01;//定時0 16位工作模式 TH0=(65536-200)/256; TL0=(65536-200)%256; TR0=1; //開始計時 ET0=1; //開定時0中斷 EA=1; //開全中斷 while(1) { ST=0; _nop_(); ST=1; _nop_(); ST=0; // EOC=0; xianshi(); while(!EOC) { xianshi(); } xianzhi=P2; xianshi(); doing(); } }
上傳時間: 2013-10-16
上傳用戶:黃蛋的蛋黃
超聲波傳感器適用于對大幅的平面進行靜止測距。普通的超聲波傳感器測距范圍大概是 2cm~450cm,分辨率3mm(淘寶賣家說的,筆者測試環境沒那么好,個人實測比較穩定的 距離10cm~2m 左右,超過此距離就經常有偶然不準確的情況發生了,當然不排除筆者技術 問題。) 測試對象是淘寶上面最便宜的SRF-04 超聲波傳感器,有四個腳:5v 電源腳(Vcc),觸發控制端(Trig),接收端(Echo),地端(GND) 附:SRF 系列超聲波傳感器參數比較 模塊工作原理: 采用IO 觸發測距,給至少10us 的高電平信號; 模塊自動發送8個40KHz 的方波,自動檢測是否有信號返回; 有信號返回,通過IO 輸出一高電平,高電平持續的時間就是超聲波從發射到返回的時間.測試距離=(高電平時間*聲速(340m/s))/2; 電路連接方法 Arduino 程序例子: constintTrigPin = 2; constintEchoPin = 3; floatcm; voidsetup() { Serial.begin(9600); pinMode(TrigPin, OUTPUT); pinMode(EchoPin, INPUT); } voidloop() { digitalWrite(TrigPin, LOW); //低高低電平發一個短時間脈沖去TrigPin delayMicroseconds(2); digitalWrite(TrigPin, HIGH); delayMicroseconds(10); digitalWrite(TrigPin, LOW); cm = pulseIn(EchoPin, HIGH) / 58.0; //將回波時間換算成cm cm = (int(cm * 100.0)) / 100.0; //保留兩位小數 Serial.print(cm); Serial.print("cm"); Serial.println(); delay(1000); }
上傳時間: 2013-11-01
上傳用戶:xiaoyuer
用途:測量地磁方向,測量物體靜止時候的方向,測量傳感器周圍磁力線的方向。注意,測量地磁時候容易受到周圍磁場影響,主芯片HMC5883 三軸磁阻傳感器特點(抄自網上): 1,數字量輸出:I2C 數字量輸出接口,設計使用非常方便。 2,尺寸小: 3x3x0.9mm LCC 封裝,適合大規模量產使用。 3,精度高:1-2 度,內置12 位A/D,OFFSET, SET/RESET 電路,不會出現磁飽和現象,不會有累加誤差。 4,支持自動校準程序,簡化使用步驟,終端產品使用非常方便。 5,內置自測試電路,方便量產測試,無需增加額外昂貴的測試設備。 6,功耗低:供電電壓1.8V, 功耗睡眠模式-2.5uA 測量模式-0.6mA 連接方法: 只要連接VCC,GND,SDA,SDL 四條線。 Arduino GND -> HMC5883L GND Arduino 3.3V -> HMC5883L VCC Arduino A4 (SDA) -> HMC5883L SDA Arduino A5 (SCL) -> HMC5883L SCL (注意,接線是A4,A5,不是D4,D5) 源程序: #include <Wire.h> #include <HMC5883L.h> HMC5883Lcompass; voidsetup() { Serial.begin(9600); Wire.begin(); compass = HMC5883L(); compass.SetScale(1.3); compass.SetMeasurementMode(Measurement_Continuous); } voidloop() { MagnetometerRaw raw = compass.ReadRawAxis(); MagnetometerScaled scaled = compass.ReadScaledAxis(); float xHeading = atan2(scaled.YAxis, scaled.XAxis); float yHeading = atan2(scaled.ZAxis, scaled.XAxis); float zHeading = atan2(scaled.ZAxis, scaled.YAxis); if(xHeading < 0) xHeading += 2*PI; if(xHeading > 2*PI) xHeading -= 2*PI; if(yHeading < 0) yHeading += 2*PI; if(yHeading > 2*PI) yHeading -= 2*PI; if(zHeading < 0) zHeading += 2*PI; if(zHeading > 2*PI) zHeading -= 2*PI; float xDegrees = xHeading * 180/M_PI; float yDegrees = yHeading * 180/M_PI; float zDegrees = zHeading * 180/M_PI; Serial.print(xDegrees); Serial.print(","); Serial.print(yDegrees); Serial.print(","); Serial.print(zDegrees); Serial.println(";"); delay(100); }
上傳時間: 2014-03-20
上傳用戶:tianyi223
The Molgedey and Schuster decorrelation algorithm, having square mixing matrix and no noise . Truncation is used for the time shifted matrix, and it is forced to be symmetric . The delay Tau is estimated . The number of independent components are calculated using Bayes Information Criterion (BIC), with PCA for dimension reduction.
標簽: decorrelation and algorithm Molgedey
上傳時間: 2013-12-13
上傳用戶:c12228
C-C方法及改進的C-C方法重構相空間的matlab程序 -------------------------------- 性能: 3000數據耗時3分鐘 -------------------------------- 參考文獻: 1、Nonlinear dynamics, delay times, and embedding windows.pdf 2、基于改進的C-C方法的相空間重構參數選擇4.pdf -------------------------------- 文件夾說明: 1、C_C_Method_luzhenbo2.m - 程序主文件,直接運行此文件即可! 2、LorenzData.dll - 產生Lorenz離散數據 3、DuffingData.dll - 產生Duffing離散數據 4、RosslerData.dll - 產生Rossler離散數據 5、ccFunction.dll - 計算S(m,N,r,t) - 原C-C方法中計算S(m,N,r,t),改進的C-C方法中計算S2(m,N,r,t) 6、ccFunction_luzhenbo.dll - 計算S(m,N,r,t) - 改進的C-C方法中計算S1(m,N,r,t) -------------------------------- 致謝: 此稿本次修改的部分靈感來源于與研學論壇網友“張文鴿”和“yangfanboy”的討論,在此表示感謝!
上傳時間: 2015-06-08
上傳用戶:lo25643
This applet illustrates the prediction capabilities of the multi-layer perceptrons. It allows to define an input signal on which prediction will be performed. The user can choose the number of input units, hidden units and output units, as well as the delay between the input series and the predicted output series. Then it is possible to observe interesting prediction properties.
標簽: capabilities illustrates multi-layer perceptrons
上傳時間: 2015-06-17
上傳用戶:lnnn30
THIS M-FILE USES THE TRANFER MATRIX METHOD TO EVALUATE THE COUPLED-MODE %EQUATIONS. THE REFLECTION SPECTRUM OF THE GRATING AND THE TRANSMISSION %SPECTRUM, DELAY AND DISPERSION OF THE FABRY-PEROT FILTER ARE SIMULATED
標簽: THE COUPLED-MODE REFLECTION EQUATIONS
上傳時間: 2015-08-11
上傳用戶:CHINA526
The objective of this projectis to design, model and simulate an autocorrelation generator circuit using 4-bit LFSR. the register and LFSR will used D flip-flop and some gates. By the autocorrelation concept, there should be 2 same length vectors, for calculating the autocorrelation , we have to design the register for storing the original vector and the shifter for make time delay.
標簽: autocorrelation objective generator projectis
上傳時間: 2015-08-17
上傳用戶:ikemada
數字選臺收音機 注意: (1)遙控發射芯片用TC9012/TC9243 經常用到的還有UPD6121和LC7461,它們的不同只處在于引導碼的時間不同或者數據位的個數不同,接受原理基本一樣。將本程序的相關位置修改就可以通用。 系統時鐘22.1184MHZ,如果用其他的時鐘請將delay.c文件中的定時器裝載值修改一下 (2) 鍵盤檢測在VFD程序中,16312可以驅動VFD,另外外部可接24個按鍵,并將按鍵值放到 其內部的存儲中,使用時只須發命令讀即可。 (3) 由于時間原因,只給出調幅波段的自動搜臺功能,調頻的自動搜臺程序和調幅一樣,自己寫了。 (4)主要用在組合機和功放機上的收音頭大部分以LC72171做鎖象環,LA1823做高中頻處理 和音頻解調,但是有的數調收音頭把鎖象環和高頻處理做在一起,典型的有TEA5757和TEA5756 TEA5757采用了一種所謂的自動調諧系統,在自動搜索時無須讀中頻,簡化了程序。
上傳時間: 2013-12-28
上傳用戶:gxmm
oid led8_test(void) { int i, j, k iic_init() for( ) { for(j=0 j<10 j++) { for(i=0 i<8 i++) { k = 9-(i+j)%10 iic_write(0x70, 0x10+i, f_szDigital[k]) } delay(1000) } } }
上傳時間: 2013-12-19
上傳用戶:BOBOniu