|
#include
#define uchar unsigned char
#define uint unsigned int
uchar code shuju[]={0xc0,0xf9,0xa4,0xb0, 0x99,0x92,0x82,0xf8, 0x80,0x90};
void ys(uint a)
{
uint b,c;
for(b=0;b
for(c=0;c<100;c++) ;
}
void main()
{
uchar a;
uint b;
TMOD=0X02;
TH0=0X14;
TL0=0X00;
IE=0X82;
TR0=1;
if(P2_0==0)
{
while(1)
{P2_7=0;
P2_7=1;
P2_7=0;
while(P2_4==0) ;
P2_6=1;
a=P1;
P2_6=0;
b=a*5/255;
P3=shuju[b/1] ;
ys(20);
} }
else
P3=shuju[8];
}
void TO() interrupt 1
{
P2_5=~P2_5;
}
求分析,我现在只显示整数部分的电压!
[ 本帖最后由 三多 于 2013-4-11 12:26 编辑 ]
|
|