#include <reg52.h>
#include "delay.h"
#include "lcd1602.h"
sbit SCK = P2^0;//sbit定义单片机的特殊功能寄存器变量
sbit SDA = P2^1;
bit ack = 0;//bit定义变量
void iic_start()
{
SDA = 1;
SCK = 1;
delay_us(1);
SDA = 0;
delay_us(1);
SCK = 0;//钳住总线,等待下次使用
}
void icc_stop()
{
SDA = 0;
SCK = 1;
delay_us(1);
SDA = 1;
delay_us(1);
SCK = 0;//钳住总线,等待下次使用
}
void iic_send_byte(unsigned char byte)
{
unsigned char i;
for(i = 0;i<8;i++)
{
#include "delay.h"
#include "lcd1602.h"
sbit SCK = P2^0;//sbit定义单片机的特殊功能寄存器变量
sbit SDA = P2^1;
bit ack = 0;//bit定义变量
void iic_start()
{
SDA = 1;
SCK = 1;
delay_us(1);
SDA = 0;
delay_us(1);
SCK = 0;//钳住总线,等待下次使用
}
void icc_stop()
{
SDA = 0;
SCK = 1;
delay_us(1);
SDA = 1;
delay_us(1);
SCK = 0;//钳住总线,等待下次使用
}
void iic_send_byte(unsigned char byte)
{
unsigned char i;
for(i = 0;i<8;i++)
{