資源簡介
ADC0808 數字電壓表(仿真+C程序)

代碼片段和文件信息
#include
#define?uchar?unsigned?char
#define?uint?unsigned?int
uchar?dispbuf[]={000000000};
uchar?code?L1[]=“Current?Voltage:“;
uchar?code?L2[]=“.v“;
uchar?code?L3[]=“HongZhi“;
uchar?getdatamn;
uint?temp;
sbit?ST=P3^0;
sbit?OE=P3^1;
sbit?EOC=P3^2;
sbit?CLK=P3^3;
sbit?RS=P2^5;
sbit?RW=P2^6;
sbit?E=P2^7;
void?delay(uint?n)
{
uint?xy;
for(x=n;x>0;x--)
for(y=110;y>0;y--);
}
void?wcom(uchar?com) ?//寫指令
{
RS=0;
RW=0;
P1=com;
delay(5);
E=1;
E=0;
}
void?wdat(uchar?dat) //寫數據
{
RS=1;
RW=0;
P1=dat;
delay(5);
E=1;
E=0;
}
void?LCD_init()
{
wcom(0x38);
wcom(0x0c);
wcom(0x06);
wcom(0x01);
}
void?main(void)
{
uchar?*ptr;
ptr=&dispbuf;
LCD_init();
ST=0;
OE=0;
? ET0=1;
? EA=1;
? TMOD=0x02;
? TH0=216;
? TL0=216;
? TR0=1;
? ST=1;
? ST=0;
wcom(0x80);
for(n=0;n<16;n++)
{
wdat(L1[n]);
}
wcom(0xc9);
for(m=0;m<7;m++)
{
wdat(L3[m]);
}
wcom(0xc1);
wdat(L2[0]);
wcom(0xc5);
wdat(L2[1]);
? while(1)
? {
?? if(EOC==1)
???? {
????? OE=1;
????? getdata=P0;
????? OE=0;
????? temp=getdata*500.0/255;
????? dispbuf[1]=temp/100+‘0‘;
wcom(0xc0);
wdat(dispbuf[1]);
????? dispbuf[2]=temp/10%10+‘0‘;
wcom(0xc2);
wdat(dispbuf[2]);
????? dispbuf[3]=temp%10+‘0‘;
wcom(0xc3);
wdat(dispbuf[3]);
????? ST=1;
????? ST=0;
???? }
? }
}
void?t0(void)?interrupt?1?using?1
{
? CLK=~CLK;
}
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件???????1460??2011-07-25?19:37??ADC0808?數字電壓表(仿真+C程序)\ADC0808+LCD數字電壓表.c
?????文件?????102507??2011-07-25?19:37??ADC0808?數字電壓表(仿真+C程序)\ADC0808+LCD數字電壓表.DSN
?????文件???????3607??2011-07-25?19:36??ADC0808?數字電壓表(仿真+C程序)\ADC0808+LCD數字電壓表.hex
?????文件??????13309??2011-07-25?16:52??ADC0808?數字電壓表(仿真+C程序)\ADC0808+LCD數字電壓表.uvproj
?????目錄??????????0??2011-07-25?21:24??ADC0808?數字電壓表(仿真+C程序)
-----------?---------??----------?-----??----
???????????????120883????????????????????5
評論
共有 條評論