请参考我以下的代码,24个输出,定义成3字节,方便输出控制,可以位操作,也可以字节操作
//变量定义
//输出虚拟端口
uchar bdata OUT0_7 _at_ 0x20;
uchar bdata OUT8_15 _at_ 0x21;
uchar bdata OUT16_23 _at_ 0x22;
sbit OUT0=OUT0_7^0; //可控硅过零输出控制加热桶加热1-8
sbit OUT1=OUT0_7^1;
sbit OUT2=OUT0_7^2;
sbit OUT3=OUT0_7^3;
sbit OUT4=OUT0_7^4;
sbit OUT5=OUT0_7^5;
sbit OUT6=OUT0_7^6;
sbit OUT7=OUT0_7^7;
sbit OUT8=OUT8_15^0; //循环水泵
sbit OUT9=OUT8_15^1; //压缩机
sbit OUT10=OUT8_15^2; //防漏电
sbit OUT11=OUT8_15^3; //水箱补水
sbit OUT12=OUT8_15^4; //声光报警
sbit OUT13=OUT8_15^5; //蠕动泵
sbit OUT14=OUT8_15^6; //10路电磁阀阀组
sbit OUT15=OUT8_15^7;
sbit OUT16=OUT16_23^0;
sbit OUT17=OUT16_23^1;
sbit OUT18=OUT16_23^2;
sbit OUT19=OUT16_23^3;
sbit OUT20=OUT16_23^4;
sbit OUT21=OUT16_23^5;
sbit OUT22=OUT16_23^6;
sbit OUT23=OUT16_23^7; |