完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
程序: 求帮助,完成不了毕不了业,求帮忙 #include #include #define uchar unsigned char #define uint unsigned int #define Addr 0x90 //??pcf8591??? #define Addw 0x91 //??pcf8591??? uchar ch0,ch1; //??pcf8591??0?????1?? uchar turblow=0; //浊度下限,低于此值led3亮起,蜂鸣器报警 uchar turbhigh=5; uchar phlow=0; uchar phhigh=14; ***it led1=P2^5;//wendu ***it led2=P2^6;//ph ***it led3=P2^7;//浊度turb(b) ***it beep=P1^4;//????? ***it key1=P1^2; ***it key2=P1^3; ***it key3=P3^2; ***it RS=P2^2; ***it RW=P2^3; ***it EN=P2^4; //??1602 ***it sda=P2^0; //???,??ph??????? ***it scl=P2^1; //??? ***it DS=P1^0; //??????? uchar code table[]="temp is"; //code?????????ROM(?????)?? uchar code table1[]="turb is"; uchar code table2[]="ph is"; uchar code table3[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f, //?????0-9?? 0xbf,0x86,0xdb,0xcf,0xe6,0xed,0xfd,0x87,0xff,0xef}; //??????0-9?? uchar code table4[]="error"; uint temp; //????? float ftemp; //?????? uchar tflag; //?????? uchar data tempdata[5]; //????????,??,??,??,??? uint templow=20; //?????,???????????? uint temphigh=50; //?????,???????????? void delayms(uint xms) //?????? { uint i,j; for(i=xms;i>0;i++) for(j=110;j>0;j--); } void delay() //???????? { _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); } void write_com(uchar com) //1602??? { RS=0; P0=com; delayms(5); EN=1; delayms(5); EN=0; } void write_data(uchar dat) //1602??? { RS=1; P0=dat; delayms(5); EN=1; delayms(5); EN=0; } void init1602() //1602??? { EN=0; write_com(0x38); //??16*2??,5*7??,8????? write_com(0x0c); //?????,????? write_com(0x06); //???????????? write_com(0x01); //????,?????? } void display(uchar *p) //1602???????? { while(*p!=' |