?? test_irsensor.c
字號:
#include <8051.h>
#include "ads7841.h"
/***************************** Main Program **********************************/
void main()
{
float x,y; // Distance and Analog voltage output
y = analog(0); // Read volt out if the sensor connect to channel 0 of ADS7841
y = 0.00122*y; // Convert BCD to DEC by multiply voltage by 5/4096
if ( (y > 0.4) && (y < 2.8) ) {
x = (y-0.19)/20.99; // Solve the linear equation
x = 1/x; // Inverse back get distance in cm.
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -