?? powervolt.c
字號:
// V51=0;
lcd_pos(0x00); //設置顯示位置為第一行的第1個字符
i = 0;
while(dis47[i] != '\0') //顯示字符"Test Fail "
{
lcd_wdat(dis47[i]);
i++;
}
lcd_pos(0x40); //設置顯示位置為第二行第1個字符
i = 0;
while(dis11[i] != '\0')
{
lcd_wdat(dis11[i]); //顯示結果
i++;
}
show_value(temp); //n中數據處理與顯示
lcd_delay(50);
goto ERROR;
}
/**************************************************************************/
Port1C8255_write(64); //+18V關
Timer100ms=2;
while(Timer100ms);
Port1C8255_write(68); //-18V開
Timer100ms=5;
while(Timer100ms);
write_ads(0x8c);
read_ads();
temp1=adc_hi;
temp1=temp1<<8;
temp1+=adc_lo;
temp=(float)temp1/32768*2.048;
temp*=1.05;
temp*=1000;
if ((temp>=Limit[6])&&(temp<=Limit[7]))
{
// V51=1;
lcd_pos(0x00); //設置顯示位置為第一行的第1個字符
i = 0;
while(dis46[i] != '\0') //顯示字符"Test Pass"
{
lcd_wdat(dis46[i]);
i++;
}
lcd_pos(0x40); //設置顯示位置為第二行第1個字符
i = 0;
while(dis12[i] != '\0') //顯示結果
{
lcd_wdat(dis12[i]);
i++;
}
show_value(temp); //n中數據處理與顯示
lcd_delay(50);
}
else
{
// V51=0;
lcd_pos(0x00); //設置顯示位置為第一行的第1個字符
i = 0;
while(dis47[i] != '\0') //顯示字符"Test Fail "
{
lcd_wdat(dis47[i]);
i++;
}
lcd_pos(0x40); //設置顯示位置為第二行第1個字符
i = 0;
while(dis12[i] != '\0')
{
lcd_wdat(dis12[i]); //顯示結果
i++;
}
show_value(temp); //n中數據處理與顯示
lcd_delay(50);
goto ERROR;
}
/**************************************************************************/
Port1C8255_write(64); //-18V關
Timer100ms=2;
while(Timer100ms);
Port1C8255_write(72); //+24Va開
Timer100ms=5;
while(Timer100ms);
write_ads(0x8c);
read_ads();
temp1=adc_hi;
temp1=temp1<<8;
temp1+=adc_lo;
temp=(float)temp1/32768*2.048;
temp*=2.015;
temp*=1000;
if ((temp>=Limit[8])&&(temp<=Limit[9]))
{
// V51=1;
lcd_pos(0x00); //設置顯示位置為第一行的第1個字符
i = 0;
while(dis46[i] != '\0') //顯示字符"Test Pass"
{
lcd_wdat(dis46[i]);
i++;
}
lcd_pos(0x40); //設置顯示位置為第二行第1個字符
i = 0;
while(dis13[i] != '\0') //顯示結果
{
lcd_wdat(dis13[i]);
i++;
}
show_value(temp); //n中數據處理與顯示
lcd_delay(50);
}
else
{
// V51=0;
lcd_pos(0x00); //設置顯示位置為第一行的第1個字符
i = 0;
while(dis47[i] != '\0') //顯示字符"Test Fail "
{
lcd_wdat(dis47[i]);
i++;
}
lcd_pos(0x40); //設置顯示位置為第二行第1個字符
i = 0;
while(dis13[i] != '\0')
{
lcd_wdat(dis13[i]); //顯示結果
i++;
}
show_value(temp); //n中數據處理與顯示
lcd_delay(50);
goto ERROR;
}
/**************************************************************************/
Port1C8255_write(64); //+24Va關
Timer100ms=2;
while(Timer100ms);
Port1C8255_write(80); //+24Vb開
Timer100ms=5;
while(Timer100ms);
write_ads(0x8c);
read_ads();
temp1=adc_hi;
temp1=temp1<<8;
temp1+=adc_lo;
temp=(float)temp1/32768*2.048;
temp*=2.015;
temp*=1000;
if ((temp>=Limit[10])&&(temp<=Limit[11]))
{
// V51=1;
lcd_pos(0x00); //設置顯示位置為第一行的第1個字符
i = 0;
while(dis46[i] != '\0') //顯示字符"Test Pass"
{
lcd_wdat(dis46[i]);
i++;
}
lcd_pos(0x40); //設置顯示位置為第二行第1個字符
i = 0;
while(dis14[i] != '\0') //顯示結果
{
lcd_wdat(dis14[i]);
i++;
}
show_value(temp); //n中數據處理與顯示
lcd_delay(50);
}
else
{
// V51=0;
lcd_pos(0x00); //設置顯示位置為第一行的第1個字符
i = 0;
while(dis47[i] != '\0') //顯示字符"Test Fail "
{
lcd_wdat(dis47[i]);
i++;
}
lcd_pos(0x40); //設置顯示位置為第二行第1個字符
i = 0;
while(dis14[i] != '\0')
{
lcd_wdat(dis14[i]); //顯示結果
i++;
}
show_value(temp); //n中數據處理與顯示
lcd_delay(50);
goto ERROR;
}
/**************************************************************************/
Port1C8255_write(64); //+24Vb關
Timer100ms=2;
while(Timer100ms);
Port1C8255_write(96); //+Vbr開
Timer100ms=5;
while(Timer100ms);
write_ads(0x8c);
read_ads();
temp1=adc_hi;
temp1=temp1<<8;
temp1+=adc_lo;
temp=(float)temp1/32768*2.048;
temp*=1.2;
temp*=1000;
if ((temp>=Limit[12])&&(temp<=Limit[13]))
{
// V51=1;
lcd_pos(0x00); //設置顯示位置為第一行的第1個字符
i = 0;
while(dis46[i] != '\0') //顯示字符"Test Pass"
{
lcd_wdat(dis46[i]);
i++;
}
lcd_pos(0x40); //設置顯示位置為第二行第1個字符
i = 0;
while(dis15[i] != '\0') //顯示結果
{
lcd_wdat(dis15[i]);
i++;
}
show_value(temp); //n中數據處理與顯示
lcd_delay(50);
}
else
{
// V51=0;
lcd_pos(0x00); //設置顯示位置為第一行的第1個字符
i = 0;
while(dis47[i] != '\0') //顯示字符"Test Fail "
{
lcd_wdat(dis47[i]);
i++;
}
lcd_pos(0x40); //設置顯示位置為第二行第1個字符
i = 0;
while(dis15[i] != '\0')
{
lcd_wdat(dis15[i]); //顯示結果
i++;
}
show_value(temp); //n中數據處理與顯示
lcd_delay(50);
goto ERROR;
}
/*******************************************************************************/
/*
SendBuffer[0]=0x56; //V
SendBuffer[1]=0x31; //1 0x20=" " W:0x57;P:0x50;F:0x46;(CR):0x0d
SendBuffer[2]=0x3b; //;
SendBuffer[3]=0x41; //A R:0x52;E:0x45;H:0x48;z:0x7A;U:0x55;
SendBuffer[4]=0x31; //1
SendBuffer[5]=0x3b; //;
SendBuffer[6]=0x3f; //?
SendBuffer[7]=0x53; //S
SendBuffer[8]=0x3b; //;
SendBuffer[9]=0x0a; //; (LF)
Send(10);
Timer1s=2;
while(Timer1s);
if (MsgOk==0x55)
{
MsgOk=0x00;
q=ReceiveBuffer[0]; //接收返回值!
b=ReceiveBuffer[1];
s=ReceiveBuffer[2];
g=ReceiveBuffer[3];
temp =(q-0x30)*1000; //ASCII 9==HEX 0x39
temp+=(b-0x30)*100;
temp+=(s-0x30)*10;
temp+=(g-0x30);
if ((temp>=Limit[14])&&(temp<=Limit[15]))
{
lcd_pos(0x00); //設置顯示位置為第一行的第1個字符
i = 0;
while(dis46[i] != '\0') //顯示字符"Test Pass"
{
lcd_wdat(dis46[i]);
i++;
}
lcd_pos(0x40); //設置顯示位置為第二行第1個字符
i = 0;
while(dis44[i] != '\0') //顯示結果
{
lcd_wdat(dis44[i]);
i++;
}
show_value1(q,b,s,g); //n中數據處理與顯示
lcd_delay(50);
}
else
{
lcd_pos(0x00); //設置顯示位置為第一行的第1個字符
i = 0;
while(dis47[i] != '\0') //顯示字符"Test Fail "
{
lcd_wdat(dis47[i]);
i++;
}
lcd_pos(0x40); //設置顯示位置為第二行第1個字符
i = 0;
while(dis44[i] != '\0')
{
lcd_wdat(dis44[i]); //顯示結果
i++;
}
show_value1(q,b,s,g); //n中數據處理與顯示
lcd_delay(50);
goto ERROR;
}
}
else
{ //未收到信息!
lcd_pos(0x00); //設置顯示位置為第一行的第1個字符
i = 0;
while(dis48[i] != '\0') //顯示字符"Comm No Respond "
{
lcd_wdat(dis48[i]);
i++;
}
lcd_pos(0x40); //設置顯示位置為第二行第1個字符
i = 0;
while(dis49[i] != '\0')
{
lcd_wdat(dis49[i]); //顯示"->> ->> ->> ->>"
i++;
}
goto ERROR;
}
*/
/****************************************************************************/
/* */
/* 第三組:120V輸入K1,MAX24負載開K5,狀態開關ON / K15 /64 */
/****************************************************************************/
Port1A8255_write(1); //110V電源開
Port1C8255_write(64); //狀態開關ON
Timer100ms=10;
while(Timer100ms);
Port1A8255_write(145); //110V電源開,負載ML110開,+5V開
Timer100ms=10;
while(Timer100ms);
write_ads(0x8c);
read_ads();
temp1=adc_hi;
temp1=temp1<<8;
temp1+=adc_lo;
temp=(float)temp1/32768*2.048;
temp*=1.025;
temp*=1000;
if ((temp>=Limit[0])&&(temp<=Limit[1]))
{
// V51=1;
lcd_pos(0x00); //設置顯示位置為第一行的第1個字符
i = 0;
while(dis46[i] != '\0') //顯示字符"Test Pass"
{
lcd_wdat(dis46[i]);
i++;
}
lcd_pos(0x40); //設置顯示位置為第二行第1個字符
i = 0;
while(dis16[i] != '\0') //顯示結果
{
lcd_wdat(dis16[i]);
i++;
}
show_value(temp); //n中數據處理與顯示
lcd_delay(50);
}
else
{
// V51=0;
lcd_pos(0x00); //設置顯示位置為第一行的第1個字符
i = 0;
while(dis47[i] != '\0') //顯示字符"Test Fail "
{
lcd_wdat(dis47[i]);
i++;
}
lcd_pos(0x40); //設置顯示位置為第二行第1個字符
i = 0;
while(dis16[i] != '\0')
{
lcd_wdat(dis16[i]); //顯示結果
i++;
}
show_value(temp); //n中數據處理與顯示
lcd_delay(50);
goto ERROR;
}
/**************************************************************************/
Port1A8255_write(17); //+5V 關
Timer100ms=2;
while(Timer100ms);
Port1C8255_write(65); //+12V開
Timer100ms=5;
while(Timer100ms);
write_ads(0x8c);
read_ads();
temp1=adc_hi;
temp1=temp1<<8;
temp1+=adc_lo;
temp=(float)temp1/32768*2.048;
temp*=1.032;
temp*=1000;
if ((temp>=Limit[2])&&(temp<=Limit[3]))
{
// V51=1;
lcd_pos(0x00); //設置顯示位置為第一行的第1個字符
i = 0;
while(dis46[i] != '\0') //顯示字符"Test Pass"
{
lcd_wdat(dis46[i]);
i++;
}
lcd_pos(0x40); //設置顯示位置為第二行第1個字符
i = 0;
while(dis17[i] != '\0') //顯示結果
{
lcd_wdat(dis17[i]);
i++;
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -