51单片机 用DAC0808实现数字调压+Proteus仿真
51单片机 用DAC0808实现数字调压+Proteus仿真
- Proteus仿真

实例代码
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
| /\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*/ #include <reg52.h> #define uint unsigned int #define uchar unsigned char
sbit K1 = P3^0; sbit K2 = P3^1; sbit K3 = P3^2; sbit K4 = P3^3; sbit K5 = P3^4; sbit K6 = P3^5; sbit K7 = P3^6; sbit K8 = P3^7;
void DelayMS(uint ms) { uchar i; while(ms--) { for(i=0;i<120;i++); } }
void main() { P2 = 0x00; while(1) { if(K1 == 0) P2 = 0; if(K2 == 0) P2 = 35; if(K3 == 0) P2 = 70; if(K4 == 0) P2 = 105; if(K5 == 0) P2 = 140; if(K6 == 0) P2 = 175; if(K7 == 0) P2 = 210; if(K8 == 0) P2 = 255; DelayMS(2); } }
|
程序源码和仿真资源
1 2 3
| 链接:https://pan.baidu.com/s/1gMu1HmRdPZ6w3t5cKbNZOA 提取码:xwhp
|
如果觉得我的文章对您有用,请随意打赏。您的支持将鼓励我继续创作!