这是我的代码
GP2_SSN = 0;
SPI1_ReadWriteByte(0x81); //写寄存器1
SPI1_ReadWriteByte(0xff);
SPI1_ReadWriteByte(0xff);
SPI1_ReadWriteByte(0xff);
SPI1_ReadWriteByte(0xb1); //读取第1个寄存器值
for(i=0;i<3;i++)
{
buf3 = SPI1_ReadWriteByte(0xff);
}
GP2_SSN = 1;
LCD_ShowxNum(30,20,buf3[2],16,24,0);
LCD_ShowxNum(30,50,buf3[1],16,24,0);
LCD_ShowxNum(30,80,buf3[0],16,24,0);
关于0x81和0xb1是八位的读写命令,改命令后三位代表寄存器地址,也就是我写寄存器1,再读寄存器1,理论读出来全是ff,ff,ff,但为什么都是0呢???
Z`S30T_LZ0)029F0E}PQX6Y.png
(17.9 KB, 下载次数: 34)
下载附件
2016-11-15 22:53 上传 |