51单片机+proteus软件仿真
学习成果,你我共享
基于51单片机+proteus软件仿真
ADC0804
模数转换硬件电路连接及显示:
C程序如下:
模数转换,0804******************// //*****************这里略去***************// #include
#include
#define uint unsigned int
sbit CS = P3^0;//片选端
sbit RD1 = P3^1;//读信号端
sbit WR1 = P3^2;//写信号端
sbit IN = P3^3;//转换完成标志
uchar i = 0,x = 20;//分辨率取20
uchar uram[3] = {0};
uchar code table[] = {0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90};//不带小数点显示数码管段码表
uchar code tabledp[] = {0x40,0x79,0x24,0x30,0x19,0x12};//带小数点显示数码管段码表 void set_show(uchar num)//可更新显示函数
{
uram[0] =num*x/1000;//除1000,注意分辨率取值
uram[1] = num*x%1000/100;
uram[2] = num*x%1000%100/10;