初级会员

- 积分
- 133
- 金钱
- 133
- 注册时间
- 2016-9-14
- 在线时间
- 25 小时
|
1金钱
使用 原子的代码,更改后读取w25q16芯片ID,但是读出的数据是ffef14,多出了一个ff,请教大家是怎么回事
原子源程序:
u16 W25QXX_ReadID(void)
{
u16 Temp = 0;
W25QXX_CS=0;
SPI5_ReadWriteByte(0x90);//·¢Ëí¶áè¡IDÃüáî
SPI5_ReadWriteByte(0x00);
SPI5_ReadWriteByte(0x00);
SPI5_ReadWriteByte(0x00);
Temp|=SPI5_ReadWriteByte(0xFF)<<8;
Temp|=SPI5_ReadWriteByte(0xFF);
W25QXX_CS=1;
return Temp;
}
我的源程序:
u16 w25qxx_read_id(void)//读flash ID
{
w25qxx_enable();
u16 temp[3];
spi1_ReadWriteByte(0x90);
spi1_ReadWriteByte(0x00);
spi1_ReadWriteByte(0x00);
spi1_ReadWriteByte(0x00);
temp[0]=spi1_ReadWriteByte(0xFF);
temp[1]=spi1_ReadWriteByte(0xFF);
temp[2]=spi1_ReadWriteByte(0xFF);
w25qxx_disable();
return temp[0]<<16|temp[1]<<8|temp[2];//成功的
//return temp[0]<<8|temp[1]//失败的,读出是ffef
} |
|
|