- UID
- 348621
- 性别
- 男
|
在IIC通信时从机接收的代码中需要对时钟设置吗?我觉得从机是可以自适应波特率的,但是有的文章中是这样写的:
例1. 用于HC908微控制器的软件(使用MC68HC908AP64)
void init_I2C(void)
{
MMCR1_MMEN = 1; //Enable IIC;
MMCR1_MMCLRBB = 1; //Clear bus busy flag;
MMCR1_MMTXAK = 1;
MMCR2_MMRW = 0; //R/W bit = 0
MMCR2_MMAST = 0; //Slave mode actually;
MMCR2_MMNAKIF = 0;
MMCR2_MMALIF = 0; //Clear flags;
MMSR = 0; //Clear all flags;
MMFDR = 3; //Set speed to 25kHz for Bus = 4MHz;
}
既然是从机了,为何还要对时钟设置? |
|