void key_s(void)
{
uchar ss=2;
uchar flat=0x00;
if( (PD_IDR & CS_I) == 0)//按键低电平有效 ==CS_I高电平有效
{
for(i=0;i<1000;i++)
{
display_b(v,bai);
display_s(v,shi);
display_g(ge);
}
if((PD_IDR & CS_I) == 0)//按键低电平有效 ==CS_I高电平有效
{
key_z=1;n=0;
while(ss-->0)
{
for(i=0;i<200;i++)
{
display_b(v,bai);
display_s(v,shi);display_g(ge);
}
delay(300);
}
while(n<15)
{
display_b(v,bai);
display_s(v,shi);
display_g(ge);
if((PD_IDR & CS_I) == 0)//按键低电平有效 ==CS_I高电平有效
{
delay(2);aj_xmi=150;TIM2_CR1=0X00;aj_num=xs;fl_a=flat;TIM4_CR1 = 0x01;
while( (PD_IDR & CS_I) == 0)//按键低电平有效 ==CS_I高电平有效
{
xs=aj_num;
v=(3.3*s/1024)*SCALE*(fd(s)/1000.0);
if(v<10.0) shu=v*1000;
else if(v<100.0&&v>=10.0)shu=v*100;
else shu=v*10;
bai=shu/1000;shi=shu%1000/100;ge=shu%100/10;
display_b(v,bai);
display_s(v,shi);display_g(ge);
}
flat = flat ^ 0xff; TIM4_CR1 = 0x00;n=0; TIM2_CR1=0X01;xs=aj_num;
}
}
E2_PROM_Write(0,xs);ss=2;
while(ss-->0)
{
delay(300);
for(i=0;i<200;i++)
{
display_b(v,bai);
display_s(v,shi);display_g(ge);
}
}
E2_PROM_Read();
key_z=0;
}
}
} |