|
请问AD9958读寄存器读出来的为什么总是FEFEFEFE
- u8 AD9958_ReadByte(void)
- {
- u8 i,dat=0;
- CS=0;
- SCLK=0;
- for (i = 0;i<8;i++)
- {
- SCLK = 0;
- dat|=SDIO0;
- SCLK = 1;
- dat <<= 1;
- }
- SCLK=0;
- IO_Update();
- CS=1;
- return dat;
- }
- u32 Read_Vau1(u8 address)
- {
- uint32_t ret=0;
- u8 add,i;
- GPIO_InitTypeDef //GPIO_InitStructure;
- add=address|0x80;
- CS=1;
-
- AD9958_SENDBYTE(add);
- // RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOA, ENABLE);
- // GPIO_InitStructure.GPIO_Pin = GPIO_Pin_5;
- // GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AN;
- // GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;
- // GPIO_Init(GPIOA, &GPIO_InitStructure);
- ret = AD9958_ReadByte();
- ret<<=8;
- ret = AD9958_ReadByte();
- ret<<=8;
- ret = AD9958_ReadByte();
- ret<<=8;
- ret = AD9958_ReadByte();
- CS=0;
- return ret;
- }
复制代码
- a=Read_Vau1(0x03);
- printf("%x\r\n",a);
复制代码
|
|