DA模块程序
[html] view plain copy
#define DAC_SYNC GpioDataRegs.GPBDAT.bit.GPIO55
#define DAC_LDAC GpioDataRegs.GPBDAT.bit.GPIO56
//Output DA
while(SpiaRegs.SPIFFTX.bit.TXFFST != 0) { }
DAC_LDAC = 0;
for(i=0;i<1;i++);
DAC_SYNC = 0;
// Transmit data
spi_xmit(DA_COMMAND);
spi_xmit(DA_data_H);
spi_xmit(DA_data_L);
for(i=0;i<300;i++);
DAC_SYNC = 1;
for(i=0;i<1;i++);
DAC_LDAC = 1;