-
为什么AD5328没有输出电压
#ifndef__SPI1_H#define__SPI1_H#include"gd32f4xx.h"/*时钟使能宏定义*/#defineSPIxSPI1#defineSPIx_CLK_ENABLE()rcu_periph_clock_enable(RCU_SPI1)#defineSPIx_SCK_GPIO_CLK_ENABLE()rcu_periph_clock_enable(RCU_GPIOB)#defineSPIx_MISO_GPIO_CLK_ENABLE()rcu_periph_clock_enable(RCU_GPIOB)#defineSPIx_MOSI_GPIO_CLK_ENABLE()rcu_periph_clock_enable(RCU_GPIOB)#defineSPIx_CS_GPIO_CLK_ENABLE()rcu_periph_clock_enable(RCU_GPIOB)#defineLDAC_GPIO_CLK_ENABLE()rcu_periph_clock_enable(RCU_GPIOB)/*SPIx引脚定义*/#defineSPIx_SCK_PINGPIO_PIN_13#defineSPIx_SCK_GPIO_PORTGPIOB#defineSPIx_MOSI_PINGPIO_PIN_15#defineSPIx_MOSI_GPIO_PORTGPIOB#defineAD5328_CS_PINGPIO_PIN_12#defineAD5328_CS_GPIO_PORTGPIOB//AD5328的LDAC引脚#defineAD5328_LDAC_PINGPIO_PIN_14#defineAD5328_LDAC_GPIO_PORTGPIOB#defineAD5328_LDAC_PINGPIO_PIN_14#defineAD5328_LDAC_GPIO_PORTGPIOB#definedigitalHi(p,i){gpio_bit_set(p,i);}//设置为高电平#definedigitalLo(p,i){gpio_bit_reset(p,i);}//设置为低电平#defineSPI_AD5328_CS_LOW()digitalLo(AD5328_CS_GPIO_PORT,AD5328_CS_PIN)#defineSPI_AD5328_CS_HIGH()digitalHi(AD5328_CS_GPIO_PORT,AD5328_CS_PIN)#defineAD5328_LDAC_LOW()digitalLo(AD5328_LDAC_GPIO_PORT,AD5328_LDAC_PIN)#defineAD5328_LDAC_HIGH()digitalHi(AD5328_LDAC_GPIO_PORT,AD5328_LDAC_PIN)voidSPI1_Init(void);//SPI1初始化voidWrite_Byte(unsignedintData);//SPI1写数据voidSPI1_Write_Data(unsignedcharChannel,unsignedintTdata);//写数据voidAD5328_Init();//AD5328初始化voidSPWM_Out_DAValue(unsignedcharChannel,unsignedintDim_Vlaue);#endif/*__SPI1_H*/#include"gd32f4xx.h"#include"main.h"#include"systick.h"unsignedintRST=0xE000;unsignedintBuff_SET=0x8000;unsignedintPOWER_DOWN
2024-06-17 1