百度网盘下载地址(975):点击下载
模拟了三路传感器,位移传感器、速度传感器、加速度传感器,三个传感器的值实时显示在液晶屏幕上。包含电源电路,单片机最小系统,三路传感器电路,显示器电路,AD采集电路。
#include <reg52.h> /* 包含头文件 */ #include <math.h> #include "uart.h" #include "display.h" #define uint unsigned int #define uchar unsigned char /* 宏定义 */ sbit ale = P2 ^ 6; sbit start = P2 ^ 7; sbit eoc = P3 ^ 2; sbit oe = P3 ^ 3; /* 定义adc0809的控制引脚 */ sbit adda = P2 ^ 0; sbit addb = P2 ^ 1; sbit addc = P2 ^ 2; /* adc0809的地址引脚 */ /* * sbit rs=P2^3; * sbit rw=P2^4; * sbit en=P2^5; //液晶的控制引脚 */ sbit key1 = P3 ^ 4; sbit key2 = P3 ^ 5; unsigned long voltdata[8]; uint i, j, k, l, t, sum, a[5]; /* 定义全局变量 */ unsigned char CH; uchar add; /* 地址变量 */ long TxBuf[8]; /* 四个显示的位 */ long realvolt; unsigned char t0Count; unsigned char flagAu = 1;