I2C中控制寄存器的Bit 7 EN: Enable. Enable the I²C peripheral. Bit 6 IE: Interrupt enable. Enable interrupts.什么意思,解释越详细越好
时间: 2023-06-18 15:03:01 浏览: 84
在 I2C 通信中,控制寄存器是用于控制 I2C 总线的硬件寄存器。其中,Bit 7 是 EN,表示“使能”,Bit 6 是 IE,表示“中断使能”。
EN(Enable):当 EN 位被设置为 1 时,I2C 外设被启用,可以进行数据传输。当 EN 位被设置为 0 时,I2C 外设被禁用,不进行数据传输。因此,通过控制 EN 位,可以控制 I2C 外设的启用和禁用。
IE(Interrupt Enable):当 IE 位被设置为 1 时,启用 I2C 中断。当 I2C 发生中断事件时,将触发中断程序。启用中断可以使主机控制器在等待传输期间执行其他操作,从而提高系统的效率。如果 IE 位被设置为 0,则不启用中断,主机控制器必须一直等待传输完成后才能执行其他操作。
因此,EN 和 IE 位对于 I2C 通信的正确进行非常重要。在使用 I2C 时,需要根据具体的应用场景和要求,设置正确的 EN 和 IE 位的值,以确保 I2C 通信的正确进行。
相关问题
STM32 I2C中CR1控制器
STM32中的I2C控制器是通过CR1寄存器来进行配置和控制的。CR1寄存器是I2C控制寄存器1,用于设置I2C的工作模式、使能I2C、配置时钟等参数。
CR1寄存器的位域如下:
- Bit 0:PE(Peripheral Enable)使能位,用于使能或禁用I2C控制器。
- Bit 1:TXIE(Transmit Interrupt Enable)发送中断使能位,用于使能或禁用发送中断。
- Bit 2:RXIE(Receive Interrupt Enable)接收中断使能位,用于使能或禁用接收中断。
- Bit 3:ADDRIE(Address Match Interrupt Enable)地址匹配中断使能位,用于使能或禁用地址匹配中断。
- Bit 4:NACKIE(Not Acknowledge Interrupt Enable)非应答中断使能位,用于使能或禁用非应答中断。
- Bit 5:STOPIE(Stop Detection Interrupt Enable)停止检测中断使能位,用于使能或禁用停止检测中断。
- Bit 6:TCIE(Transfer Complete Interrupt Enable)传输完成中断使能位,用于使能或禁用传输完成中断。
- Bit 7:ERRIE(Error Interrupt Enable)错误中断使能位,用于使能或禁用错误中断。
- Bit 8:DNF(Digital Noise Filter)数字噪声滤波器位域,用于配置数字噪声滤波器的滤波系数。
- Bit 10:ANFOFF(Analog Noise Filter OFF)模拟噪声滤波器使能位,用于使能或禁用模拟噪声滤波器。
- Bit 11:TXDMAEN(DMA Transmission Requests Enable)DMA发送请求使能位,用于使能或禁用DMA发送请求。
- Bit 12:RXDMAEN(DMA Reception Requests Enable)DMA接收请求使能位,用于使能或禁用DMA接收请求。
- Bit 13:SBC(Slave Byte Control)从机字节控制位,用于配置从机字节控制。
- Bit 14:NOSTRETCH(Clock Stretching Disable)时钟拉伸禁止位,用于禁止时钟拉伸。
- Bit 15:GCEN(General Call Enable)广播地址使能位,用于使能或禁用广播地址。
- Bit 16:SMBHEN(SMBus Host Address Enable)SMBus主机地址使能位,用于使能或禁用SMBus主机地址。
- Bit 17:SMBDEN(SMBus Device Default Address Enable)SMBus设备默认地址使能位,用于使能或禁用SMBus设备默认地址。
- Bit 18:ALERTEN(SMBus Alert Enable)SMBus警报使能位,用于使能或禁用SMBus警报。
以上是CR1寄存器的各个位域的功能和作用。通过配置CR1寄存器的不同位域,可以实现对I2C控制器的灵活控制和配置。
The lower three bits (i.e. 2,1,0) of the Address Byte will contain peripheral specific commands.
This statement is not necessarily true. The lower three bits of the Address Byte may contain peripheral specific commands in some communication protocols, but not all. It depends on the specific protocol being used.
相关推荐
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)