2020-01-25 15:22发布
HDIY 发表于 2013-12-29 15:15 我在做数码管电子钟时,不用PCB直接接连数码管和单片机时,就遇到这种情况,需要定义不同管脚成为同一组, ...
最多设置5个标签!
- void PORT_Assignment(unsigned char WriteData)
- {
- if (WriteData & 0x01) {dataPortO = 1;}else{dataPortO = 0;}
- if (WriteData & 0x02) {dataPort1 = 1;} else{dataPort1 = 0;}
- if (WriteData & 0x04) {dataPort2 = 1;} else{dataPort2 = 0;}
- if (WriteData & 0x08) {dataPort3 = 1;} else{dataPort3 = 0;}
- if (WriteData & 0x10) {dataPort4 = 1;} else{dataPort4 = 0;}
- if (WriteData & 0x20) {dataPort5 = 1;} else{dataPort5 = 0;}
- if (WriteData & 0x40) {dataPort6 = 1;} else{dataPort6 = 0;}
- if (WriteData & 0x80) {dataPort7 = 1;} else{dataPort7 = 0;}
- }
复制代码一周热门 更多>