我按照DateSheet上输出控制,第三个通道,为何无电压输出。
原理图如下:
SPI控制时序如下:
使用万用表测量发现无电压输出,如下:#define NOOP_ADDRESS ((uint8_t)0x00)
#define DEVICE ID_ADDRESS ((uint8_t)0x01)
/* 3 SYNC register address */
#define SYNC_ADDRESS ((uint8_t)0x02)
/* SYNC default (reset) value */
#define SYNC_DEFAULT ((uint16_t)0xFF00)
/* 4 GAIN register address */
#define GAIN_ADDRESS ((uint8_t)0x04)
/* 5 TRIGGER register address */
#define TRIGGER_ADDRESS ((uint8_t)0x05)
/* 6 BRDCAST register address */
#define BRDCAST_ADDRESS ((uint8_t)0x06)
/* 7 STATUS register address */
#define STATUS_ADDRESS ((uint8_t)0x07)
/* 8 DAC ͨ����ַ */
typedef enum
{
DAC0_ADDRESS = 0x08,
DAC1_ADDRESS = 0x09,
DAC2_ADDRESS = 0x0A,
DAC3_ADDRESS = 0x0B,
DAC4_ADDRESS = 0x0C,
DAC5_ADDRESS = 0x0D,
DAC6_ADDRESS = 0x0E,
DAC7_ADDRESS = 0x0F
} DAC_CH_ADDRESS;
void TI_DAC60508_Setup(void);
void DAC60508_WriteDate(DAC_CH_ADDRESS ch, uint16_t wdate);
void DAC60508_SetVoltage(DAC_CH_ADDRESS ch, float voltage);
#include "dev_dac60508.h"
void TI_DAC60508_Setup(void)
{
SPI1Init(SPI_MODE3);
}
void DAC60508_WriteDate(DAC_CH_ADDRESS ch, uint16_t wdate)
{
uint8_t date[3];
uint8_t rdate[3];
date[0] = (uint8_t)ch;
date[1] = (uint8_t)(wdate>>8);
date[2] = (uint8_t)wdate;
SPI1ReadWriteBuffer(&rdate[0], &date[0], 3);
}
void DAC60508_SetVoltage(DAC_CH_ADDRESS ch, float voltage)
{
uint16_t code;
code = voltage/2.5*0x1000;
DAC60508_WriteDate(ch, code);
}
#include "dev_dac60508.h"
int main(void)
{
HalInit(); // CPU内部接口初始化
TI_DAC60508_Setup();
while(1)
{
DAC60508_WriteDate(DAC3_ADDRESS, 500);
DelayMs(500);
DAC60508_WriteDate(DAC3_ADDRESS, 1000);
DelayMs(500);
DAC60508_WriteDate(DAC3_ADDRESS, 1500);
DelayMs(500);
DAC60508_WriteDate(DAC3_ADDRESS, 2000);
DelayMs(500);
DAC60508_WriteDate(DAC3_ADDRESS, 2500);
DelayMs(500);
DAC60508_WriteDate(DAC3_ADDRESS, 3000);
DelayMs(500);
DAC60508_WriteDate(DAC3_ADDRESS, 3500);
DelayMs(500);
DAC60508_WriteDate(DAC3_ADDRESS, 4000);
DelayMs(500);
}
return 1;
}
请问哪里配置有问题?