pca9555.h

来自「proteus实例集锦」· C头文件 代码 · 共 69 行

H
69
字号
#ifndef __pca9555_H__
#define __pca9555_H__

#define W9555 	        0x42					  //9555写
#define R9555 		    0x43					  //9555读
#define Cmd_ip0  	    0x00
#define Cmd_ip1  	    0x01
#define Cmd_op0  	    0x02
#define Cmd_op1  	    0x03
#define Cmd_polarity0  	0x04
#define Cmd_polarity1  	0x05
#define Cmd_cfg0     	0x06
#define Cmd_cfg1  	    0x07

/*-----------写pca9555输出寄存器---------------*/
void W9555output(uchar input1,uchar input2)
{
	IICStart();
	IICSendByte(W9555);
	IICSendByte(Cmd_op0);
	IICSendByte(input1);
	IICSendByte(input2);
	IICStop();
}
/*------------写pca9555配置寄存器------------*/
void W9555cfg(uchar input1,uchar input2)
{
	IICStart();
	IICSendByte(W9555);
	IICSendByte(Cmd_cfg0);
	IICSendByte(input1);
	IICSendByte(input2);
	IICStop();
}
void pca9555_init(void)
{
	 W9555cfg(0x00,0x00);     //设置I/O状态
	 W9555output(0x00,0x00);  //
}
void Opt9555(uchar cmd,uchar data_1) 		
{
    pca9555_init();
	IICStart();
	IICSendByte(W9555);
	IICSendByte(cmd);	
    IICSendByte(data_1);	
	IICStart();
}
/*
void Ipt9555(uchar idata *i9555temp)
{	
    
    pca9555_init();
	IICStart();
	IICSendByte(W9555);
	IICSendByte(Cmd_ip0);
	IICStart();
	IICSendByte(R9555);
	*i9555temp=IICReceiveByte();
	IICAck();
	i9555temp++;
	*i9555temp=IICReceiveByte();
	IICNoAck();
	
} */
//


#endif

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?