- /*****************************************************************************/
- /*功能:实现MAX517芯片的D/A转换。没按一次KO键,数字量加一,******************/
- /*显示的模拟量增加一个单位*/
- /****************************************************************************/
- #include <reg51.h>
- #include<intrins.h>
- #define uchar unsigned char
- #define uint unsigned int
- sbit SCL=P1^0;
- sbit SDA=P1^1;
- sbit K0=P2^0;
- void start(void)
- {
- SDA=1;
- SCL=1;
- _nop_();
- SDA=0;
- _nop_();
- }
- void stop(void)
- {
- SDA=0;
- SCL=1;
- _nop_();
- SDA=1;
- _nop_();
- }
- void ack(void)
- {
- SDA=0;
- _nop_();
- SCL=1;
- _nop_();
- SCL=0;
- }
|