Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- bit IIC_writeByte(unsigned char uchData)
- {
- unsigned char x = 0;
- bit bAck = 0;
- while(x < 8)
- {
- SCL=0;
- wait5us();
- SDA=(uchData & AND_MASK)>>7;
- uchData=uchData<<1;
- SCL=1
- wait5us();
- x++;
- }
- bAck=SDA;
- return(bAck);
- }
- -----
- unsigned int IIC_read_byte(bit bAck)
- {
- unsigned char x = 0;
- unsigned char uchData = 0;
- while(x < 8)
- {
- uchData = (uchData<<1) | (unsigned char)SDA;
- }
- SDA=bAck;
- return(uchData);
- }
Advertisement
Add Comment
Please, Sign In to add comment