还有个很急得问题:我对IIC进行了初始化,并且向数据寄存器写入了设备地址,但是SCL角练始终都不产生,斑竹指点下看哪里有问题:
tU08 Temperature;
tU08 read_LM75(void);
void main(void) {
IBFD = 0x00;
IBAD = 0xEC;
IBCR = 0xA0;
/* put your own code here */
EnableInterrupts;
for(;;) {
Temperature = read_LM75();
}
}
tU08 read_LM75(void)
{
tU08 tmp = 0;
while(IBSR&0x20) {
} //if bus is free
IBCR |= 0x10;
IBDR = 0x91;
while(!(IBSR&0x20)) {
} //if bus is busy
while(!(IBSR&0x02)) {
} //wait for ack
while(IBSR&0x01) {
}
IBSR |= 0x02;
IBCR&=0xEF;
tmp = IBDR;
return(tmp);
} |