-
溫濕度傳感器 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;//取轉(zhuǎn)換結(jié)果
uchar seth;//高時間
uchar setl;//低時間
uchar seth_mi;//高時間
uchar setl_mi;//低時間
bit hlbz;//高低標(biāo)志
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;//產(chǎn)生時鐘
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();
}
}
標(biāo)簽:
sht
11
溫濕度傳感器
仿真程序
上傳時間:
2013-10-16
上傳用戶:黃蛋的蛋黃
-
超聲波傳感器適用于對大幅的平面進行靜止測距。普通的超聲波傳感器測距范圍大概是 2cm~450cm,分辨率3mm(淘寶賣家說的,筆者測試環(huán)境沒那么好,個人實測比較穩(wěn)定的 距離10cm~2m 左右,超過此距離就經(jīng)常有偶然不準(zhǔn)確的情況發(fā)生了,當(dāng)然不排除筆者技術(shù) 問題。)
測試對象是淘寶上面最便宜的SRF-04 超聲波傳感器,有四個腳:5v 電源腳(Vcc),觸發(fā)控制端(Trig),接收端(Echo),地端(GND)
附:SRF 系列超聲波傳感器參數(shù)比較
模塊工作原理:
采用IO 觸發(fā)測距,給至少10us 的高電平信號;
模塊自動發(fā)送8個40KHz 的方波,自動檢測是否有信號返回;
有信號返回,通過IO 輸出一高電平,高電平持續(xù)的時間就是超聲波從發(fā)射到返回的時間.測試距離=(高電平時間*聲速(340m/s))/2;
電路連接方法
Arduino 程序例子:
constintTrigPin = 2;
constintEchoPin = 3;
floatcm;
voidsetup()
{
Serial.begin(9600);
pinMode(TrigPin, OUTPUT);
pinMode(EchoPin, INPUT);
}
voidloop()
{
digitalWrite(TrigPin, LOW); //低高低電平發(fā)一個短時間脈沖去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; //保留兩位小數(shù)
Serial.print(cm);
Serial.print("cm");
Serial.println();
delay(1000);
}
標(biāo)簽:
Arduino
連接
超聲波傳感器
上傳時間:
2013-11-01
上傳用戶:xiaoyuer
-
用途:測量地磁方向,測量物體靜止時候的方向,測量傳感器周圍磁力線的方向。注意,測量地磁時候容易受到周圍磁場影響,主芯片HMC5883 三軸磁阻傳感器特點(抄自網(wǎng)上):
1,數(shù)字量輸出:I2C 數(shù)字量輸出接口,設(shè)計使用非常方便。
2,尺寸小: 3x3x0.9mm LCC 封裝,適合大規(guī)模量產(chǎn)使用。
3,精度高:1-2 度,內(nèi)置12 位A/D,OFFSET, SET/RESET 電路,不會出現(xiàn)磁飽和現(xiàn)象,不會有累加誤差。
4,支持自動校準(zhǔn)程序,簡化使用步驟,終端產(chǎn)品使用非常方便。
5,內(nèi)置自測試電路,方便量產(chǎn)測試,無需增加額外昂貴的測試設(shè)備。
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);
}
標(biāo)簽:
Arduino
5883L
5883
HMC
上傳時間:
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.
標(biāo)簽:
decorrelation
and
algorithm
Molgedey
上傳時間:
2013-12-13
上傳用戶:c12228
-
C-C方法及改進的C-C方法重構(gòu)相空間的matlab程序
--------------------------------
性能:
3000數(shù)據(jù)耗時3分鐘
--------------------------------
參考文獻:
1、Nonlinear dynamics, delay times, and embedding windows.pdf
2、基于改進的C-C方法的相空間重構(gòu)參數(shù)選擇4.pdf
--------------------------------
文件夾說明:
1、C_C_Method_luzhenbo2.m - 程序主文件,直接運行此文件即可!
2、LorenzData.dll - 產(chǎn)生Lorenz離散數(shù)據(jù)
3、DuffingData.dll - 產(chǎn)生Duffing離散數(shù)據(jù)
4、RosslerData.dll - 產(chǎn)生Rossler離散數(shù)據(jù)
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)
--------------------------------
致謝:
此稿本次修改的部分靈感來源于與研學(xué)論壇網(wǎng)友“張文鴿”和“yangfanboy”的討論,在此表示感謝!
標(biāo)簽:
C-C
matlab
3000
程序
上傳時間:
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.
標(biāo)簽:
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
標(biāo)簽:
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.
標(biāo)簽:
autocorrelation
objective
generator
projectis
上傳時間:
2015-08-17
上傳用戶:ikemada
-
數(shù)字選臺收音機
注意:
(1)遙控發(fā)射芯片用TC9012/TC9243
經(jīng)常用到的還有UPD6121和LC7461,它們的不同只處在于引導(dǎo)碼的時間不同或者數(shù)據(jù)位的個數(shù)不同,接受原理基本一樣。將本程序的相關(guān)位置修改就可以通用。
系統(tǒng)時鐘22.1184MHZ,如果用其他的時鐘請將delay.c文件中的定時器裝載值修改一下
(2)
鍵盤檢測在VFD程序中,16312可以驅(qū)動VFD,另外外部可接24個按鍵,并將按鍵值放到
其內(nèi)部的存儲中,使用時只須發(fā)命令讀即可。
(3)
由于時間原因,只給出調(diào)幅波段的自動搜臺功能,調(diào)頻的自動搜臺程序和調(diào)幅一樣,自己寫了。
(4)主要用在組合機和功放機上的收音頭大部分以LC72171做鎖象環(huán),LA1823做高中頻處理
和音頻解調(diào),但是有的數(shù)調(diào)收音頭把鎖象環(huán)和高頻處理做在一起,典型的有TEA5757和TEA5756
TEA5757采用了一種所謂的自動調(diào)諧系統(tǒng),在自動搜索時無須讀中頻,簡化了程序。
標(biāo)簽:
TC
9012
6121
7461
上傳時間:
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)
}
}
}
標(biāo)簽:
for
iic_init
test
void
上傳時間:
2013-12-19
上傳用戶:BOBOniu