完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
怎么写判断采集到的压力值与压力设置的上下限阈值比较的程序,我的如下,就是运行不出来,急救~ #include #include #include #define uint unsigned int #define uchar unsigned char uint bai,shi,ge,fen,pbai,pshi,pge,pfen; uint flag; uchar i; uchar break1=1;//全局变量,开始键按下后,置-1 uint p; uint p1,p2; //用于判断压力高低用,p1上限,p2下限 ***it lcdrs=P3^5; ***it lcdrw=P3^6; ***it lcden=P3^4; uchar code dis1[] = {"欢迎使用"}; uchar code dis2[] = {"压力系统"}; uchar code dis3[] = {"设置"}; uchar code dis4[] = {"开始"}; uchar code dis5[] ={"设置压力范围"}; uchar code dis6[]={"当前压力"}; uchar code dis7[]={"压力高,放气中.."}; uchar code dis8[]={"压力低,充气中.."}; //uchar code dis9[]={"v"}; //uchar code dis10[]={"cmH2O"}; uchar code dis9[]={"压力正常"}; uchar code dis10[]={"设置完成"}; uchar code dis11[]={"设置中.."}; uchar code pressure[]={"0123456789"}; uchar tab1[] ={"H:35cmH2O"}; //上域 uchar tab2[] ={"L:25cmH2O"}; //下域 uchar tab3[11] ={"电压:0.000v"}; //当前电压值 uchar tab4[14] ={"压力:0000cmH2O"}; //当前压力值 uint yuzhi[3]={35,25,00};//存放阈值数组 void main() { delay(10); //延时 wela=0; //屏蔽数码管位选 dula=0; //屏蔽数码管段选 lcd_init(); begin(); while(1) { keyscan(); //按键扫描 if (break1==-1) { display(); p1=10*tab1[2]+tab1[3]; p2=10*tab2[2]+tab2[3]; if(p2 { lcd_pos(3,0); i = 0; while(dis9 != ' |