初级会员

- 积分
- 121
- 金钱
- 121
- 注册时间
- 2019-3-27
- 在线时间
- 50 小时
|
5金钱
本帖最后由 Wenmin 于 2019-3-27 20:26 编辑
这是时序图片,以下是程序(写入芯片)
void ADN8810write(u16 num)
{
RESET=1;
delay_us(20);//¾àÕyêy¾Y′íλ
CS=0;
SPI1_ReadWriteByte(11);
SPI1_ReadWriteByte(num);
// SPI1_ReadWriteByte((u8)(num));
// delay_us(1);
while (SPI_I2S_GetFlagStatus(SPI1, SPI_I2S_FLAG_BSY)==SET){}//μè′yspi¿ÕÏD
// delay_us(2);
// delay_us(20);
delay_us(1);
CS=1;
RESET=0;
// RESET=1;
}
u8 SPI1_ReadWriteByte(u8 TxData)
{
SPI_I2S_SendData(SPI1, TxData); //í¨1yíaéèSPIx·¢Ëíò»¸öbyte êy¾Y
delay_us(3);
while (SPI_I2S_GetFlagStatus(SPI1, SPI_I2S_FLAG_TXE)== RESET){}//μè′yspi¿ÕÏD
}
主函数功能是写入两个8位数据,逻辑分析仪的数据值正确,但为什么重复发了三次,而且CS片选线自己跳变。??????
|
-
最佳答案
查看完整内容[请看2#楼]
Data applied to the SDI pin is clocked into the input shift register on the rising edge of CLK. After all 16 bits of the data-word have been clocked into the input shift register, a logic high on CS loads the shift register byte into the chip. If more than 16 bits of data are clocked into the shift register before CS goes high, bits are pushed out of the register in first-in first-out (FIFO) fashi ...
|