内容发布更新时间 : 2024/11/14 11:56:14星期一 下面是文章的全部内容请认真阅读。
AD_Init();
EX0=1; IT0=1; EA=1;
P3M1=0x00; P3M0=0x21;
FS = 0; RL1 = 0; RL2 = 0; RL3 = 0; RL4 = 0; ON = 0;
Step_flag = IU_Step[IU_flag];
// Pant(0xff,0xff); // Pant(0xf8,0x00); // // Pant(0X07,0xE0); // // Pant(0x00,0x1f); // Pant(0x00,0x00); //
LCD_CS =0; //
ChineseChar(20,10,2,colors[2],colors[4],1); // ChineseChar(38+14,10,2,colors[2],colors[4],2); // ChineseChar(38+46,10,2,colors[2],colors[4],3); // ChineseChar(70+46,10,2,colors[2],colors[4],4); // ChineseChar(102+46,10,2,colors[2],colors[4],5); // ChineseChar(134+46,10,2,colors[2],colors[4],6); //
U = Read_EEPROM(0x00); I = Read_EEPROM(0x02);
Temp = result(3);
sprintf(buffer,\
LCD_ShowString(0,50,M,colors[7],colors[4],buffer);
U_RL = ((U<<1)/100+2)>>1; if(U==0)U_RL=0;
if(U_RL>=0x0f)U_RL=0x0f; P1 = (P1&0x0F)|(U_RL<<4); write_da_U(U); write_da_I(I);
sprintf(buffer,\880);
LCD_ShowString(0,150,M,colors[5],colors[4],buffer); nI=sprintf(buffer,\
LCD_ShowString(240-nI*M,296,M,colors[5],colors[4],buffer);
while(1) {
if(IU_flag==0) {
U_RL = ((U<<1)/100+2)>>1; if(U==0)U_RL=0;
if(U_RL>=0x0f)U_RL=0x0f; P1 = (P1&0x0F)|(U_RL<<4);
write_da_I(I); write_da_U(U);
if(U<400)U_U = (float)U*0.02+0.052; else if(U<550)U_U = (float)U*0.02+0.06; else if(U<719)U_U = (float)U*0.02+0.065; else if(U<1200)U_U = (float)U*0.02+0.071; else if(U<1500)U_U = (float)U*0.02+0.083; else if(U<1585)U_U = (float)U*0.02+0.10; else U_U = (float)U*0.02+0.11;
if(U_U<10.000)sprintf(buffer,\ else sprintf(buffer,\
LCD_ShowString(0,100,M,colors[1],colors[4],buffer); nU=sprintf(buffer,\
LCD_ShowString(240-nU*M,296,M,colors[1],colors[4],buffer); }
if(IU_flag) {
write_da_U(U); write_da_I(I);
sprintf(buffer,\loat)I/880);
LCD_ShowString(0,150,M,colors[5],colors[4],buffer); nI=sprintf(buffer,\
LCD_ShowString(240-nI*M,296,M,colors[5],colors[4],buffer); }
if((AD_delay==1)&&(AD_flag==0)) {
U_buffer[i1]=AD_V(1); i1++;
if(i1==10)i1 = 0;
AD_delay=0; time_AD=0; AD_flag = 1; }
if((AD_delay==1)&&(AD_flag==1)) {
I_buffer[i2]=AD_V(2); i2++;
if(i2==10)i2 = 0;
AD_delay=0; time_AD=0; AD_flag = 0; }
if(time0>=200) {
time0=0;
for(i3=0;i3<10;i3++)ADV += U_buffer[i3]; ADV1=ADV; ADV2=ADV1; ADV3=ADV2;
ADV = (ADV1+ADV2/2.0+ADV3/4.0)/1.75; ADV /= 10.0;
ADV = ADV*20.00*2.048/65536.000+0.009;
}
}
if(ADV<10)sprintf(buffer,\ else sprintf(buffer,\
LCD_ShowString(0,200,M,colors[1],colors[4],buffer); ADV = 0; }
if(time3>=200) {
time3=0;
for(i3=0;i3<10;i3++)ADI += I_buffer[i3]; ADI1=ADI; ADI2=ADI1; ADI3=ADI2;
ADI = (ADI1+ADI2/2.0+ADI3/4.0)/1.75; ADI /= 10.0;
ADI = ADI*5.025*2.048/65536.000;
sprintf(buffer,\
LCD_ShowString(0,250,M,colors[5],colors[4],buffer); ADI = 0; }
if(time1>=1000) {
time1=0;
Temp = result(3);
sprintf(buffer,\
LCD_ShowString(0,50,M,colors[7],colors[4],buffer); if(Temp>=33.0)FS = 1;
else if(Temp<=28)FS = 0; Write_EEPROM(0x00,U,I); }