📄 powervolt.c
字号:
{
// 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(dis4[i] != '\0') //显示结果
{
lcd_wdat(dis4[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(dis4[i] != '\0')
{
lcd_wdat(dis4[i]); //显示结果
i++;
}
show_value(temp); //n中数据处理与显示
lcd_delay(50);
goto ERROR;
}
/**************************************************************************/
Port1C8255_write(0); //+18V关
Timer100ms=2;
while(Timer100ms);
Port1C8255_write(4); //-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*=0.01;
temp*=1000;
if ((temp>=0)&&(temp<=100))
{
// 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(dis5[i] != '\0') //显示结果
{
lcd_wdat(dis5[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(dis5[i] != '\0')
{
lcd_wdat(dis5[i]); //显示结果
i++;
}
show_value(temp); //n中数据处理与显示
lcd_delay(50);
goto ERROR;
}
/**************************************************************************/
Port1C8255_write(0); //-18V关
Timer100ms=2;
while(Timer100ms);
Port1C8255_write(8); //+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*=0.05;
temp*=1000;
if ((temp>=0)&&(temp<=100))
{
// 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(dis6[i] != '\0') //显示结果
{
lcd_wdat(dis6[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(dis6[i] != '\0')
{
lcd_wdat(dis6[i]); //显示结果
i++;
}
show_value(temp); //n中数据处理与显示
lcd_delay(50);
goto ERROR;
}
/**************************************************************************/
Port1C8255_write(0); //+24Va关
Timer100ms=2;
while(Timer100ms);
Port1C8255_write(16); //+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*=0.01;
temp*=1000;
if ((temp>=0)&&(temp<=100))
{
// 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(dis7[i] != '\0') //显示结果
{
lcd_wdat(dis7[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(dis7[i] != '\0')
{
lcd_wdat(dis7[i]); //显示结果
i++;
}
show_value(temp); //n中数据处理与显示
lcd_delay(50);
goto ERROR;
}
/**************************************************************************/
Port1C8255_write(0); //+24Vb关
Timer100ms=2;
while(Timer100ms);
Port1C8255_write(32); //+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*=0.01;
temp*=1000;
if ((temp>=0)&&(temp<=100))
{
// 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(dis8[i] != '\0') //显示结果
{
lcd_wdat(dis8[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(dis8[i] != '\0')
{
lcd_wdat(dis8[i]); //显示结果
i++;
}
show_value(temp); //n中数据处理与显示
lcd_delay(50);
goto ERROR;
}
/****************************************************************************/
/* */
/* 第二组:120V输入K1,LOW负载开K4,状态开关ON / K15 */
/****************************************************************************/
Port1A8255_write(1); //110V电源开
Port1C8255_write(64); //状态开关ON
Timer100ms=10;
while(Timer100ms);
Port1A8255_write(137); //110V电源开,负载LL110开,+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.023;
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(dis9[i] != '\0') //显示结果
{
lcd_wdat(dis9[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(dis9[i] != '\0')
{
lcd_wdat(dis9[i]); //显示结果
i++;
}
show_value(temp); //n中数据处理与显示
lcd_delay(50);
goto ERROR;
}
/**************************************************************************/
Port1A8255_write(9); //+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(dis10[i] != '\0') //显示结果
{
lcd_wdat(dis10[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(dis10[i] != '\0')
{
lcd_wdat(dis10[i]); //显示结果
i++;
}
show_value(temp); //n中数据处理与显示
lcd_delay(50);
goto ERROR;
}
/**************************************************************************/
Port1C8255_write(64); //+12V关
Timer100ms=2;
while(Timer100ms);
Port1C8255_write(66); //+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.15;
temp*=1000;
if ((temp>=Limit[4])&&(temp<=Limit[5]))
{
// 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(dis11[i] != '\0') //显示结果
{
lcd_wdat(dis11[i]);
i++;
}
show_value(temp); //n中数据处理与显示
lcd_delay(50);
}
else
{
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -