?? 采樣—顯示.c
字號:
for(addr=1;addr<=2;addr++)
{
k=0;
AUXR=0X00;
uart();
//顯示點數(shù)
AUXR=AUXR|2;
jis[0]=len/100+0x30;
jis[1]=(len%100)/10+0x30;
jis[2]=(len%10)+0x30;
TextDisp( 5,20, jis );
AUXR=0X00;
WP=0;
// for(i=0;i<len;i++) //寫數(shù)據(jù)
// write24c16(i,E2prow[i]); //
//讀寫24c16
// page_wr(0,len,E2prow); // 2*MAX
AUXR=AUXR|2;
LcmClear();
j=0;
for(i=0;i<MAX;i++)//讀24c16,并將收到的數(shù)據(jù)還原
{
AUXR=0X00;
// high=read24c16(i);
// low=read24c16(i+1);
// high=1;
// low=0;
/* high=E2prow[i];
low=E2prow[i+1];
temp1=(uint)(high);
temp1=temp1<<8;
temp2=(uint)(low);
sum=temp2|temp1; */
if(i>20&&E2prow[i]<3031)
{
shu[i%5]=real(E2prow[i-1],E2prow[i]);
for(s=0;s<5;s++)
hezhi+=shu[s];
//sumax=hezhi;
if(sumin>=hezhi)
{sumin=hezhi;
cunzhu=i; }
//if(sumax<hezhi)
// sumax=hezhi;
}
//計算采樣電壓值
advalue=E2prow[i]*5.0/4095;
y[j]= (uchar)(advalue*30);// 縱坐標(biāo)增加的格數(shù)
temp3=advalue*100;
temp3=temp3*100;
temp=(uint)temp3;
dat[0]=temp/10000+0x30;
temp=temp%10000;
dat[1]='.';
dat[2]=temp/1000+0x30;
temp=temp%1000;
dat[3]=temp/100+0x30;
temp=temp%100;
dat[4]=temp/10+0x30 ;
temp=temp%10;
dat[5]=temp+0x30;
dat[6]='V';
dat[7]='\0';
AUXR=AUXR|2; //禁用RAM
//j++;
//文本方式顯示數(shù)組內(nèi)容
if(i%5==0) //一行5個數(shù)據(jù)
k++;
if(k==30)
{
LcmClear();
k++;
}
TextDisp( 8*(i%5),k%30,dat); //顯示數(shù)據(jù)
AUXR=0x00;
j++;
delayms(200);
}
WP=1;count=j;
delaym(200);
/* for(i=0;i<2*MAX;i++) //測試24c16讀寫是否有誤
shu[i]=read24c16(i);
TextDisp(0,5, shu ); */
AUXR=AUXR|2;
LcmClear();
WriteCommand( Ovlay ); // 顯示合成方式設(shè)置
WriteData(0x1c); // 設(shè)置參數(shù):三重疊合成; 顯示一,三
Linexy( 20, 48, 20, 200 ,1);
Linexy( 20, 200, 273, 200 ,1);
Linexy( 20, 50, 23, 50 ,1);
Linexy( 20, 100, 23, 100, 1 );
Linexy( 20, 150, 23, 150,1);
dprintf(15,10, StrForMixed1,1); // 圖形方式下中英文混合字符串的顯示
dprintf(3,42, "5V",1);
starx=20;
stary=200;
// WP=0;
for(i=0;i<count;i++)//讀24c16,并將收到的數(shù)據(jù)還原
{
AUXR=0x00;
y1=y[i];
//y2= y[i+1];
AUXR=AUXR|2;
Point(starx, stary-y1, 1 ) ;
// Linexy( 20+starx, 200-y1, 22+starx,200-y2 ,1);
starx=starx+1;
}
delaym(300);
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -