[color=rgba(0, 0, 0, 0.85) !important]在 PIC 单片机的 MCC(MikroC Pro for PIC)开发中,SPI(串行外设接口)的模式由时钟极性(CPOL)和时钟相位(CPHA)决定,具体意义如下:
SPI 模式的核心参数- [color=rgb(0, 0, 0) !important]时钟极性(CPOL):决定 SPI 时钟(SCK)的空闲电平。
- [color=rgb(0, 0, 0) !important]CPOL=0:SCK 空闲时为低电平,工作时高电平为有效脉冲。
- [color=rgb(0, 0, 0) !important]CPOL=1:SCK 空闲时为高电平,工作时低电平为有效脉冲。
- [color=rgb(0, 0, 0) !important]时钟相位(CPHA):决定数据采样的时钟边沿。
- [color=rgb(0, 0, 0) !important]CPHA=0:数据在 SCK 的第一个边沿(上升沿或下降沿,取决于 CPOL)采样。
- [color=rgb(0, 0, 0) !important]CPHA=1:数据在 SCK 的第二个边沿采样。
|