void AD7799_INIT(void)
{
WriteByteToAd7799(0x10); //b0001 0000
/* Writes to Communications Register Setting Next Operation as Write to CONFIGURATION Register*/
WriteByteToAd7799(0x37); //B0011 0111
WriteByteToAd7799(0x30); //B0011 0000
/*CONFIGURATION REGISTER[00,BO(0),U/B(0),0(0),G2(1),G1(1),G0(1),0,0,REF_DET(0),BUF(1),0(0),CH2(0),CH1(0),CH0(0)]*/
WriteByteToAd7799(0x08);
//b0000 1000
/* Writes to Communications Register Setting Next Operation as Write to Mode Register*/
WriteByteToAd7799(0x80);
WriteByteToAd7799(0x0A);
/* Writes to Mode Register Initiating Internal Zero-Scale Calibration*/
//WaiteRDY();
_delay_ms(5);
/* Wait for RDY pin to go low to indicate end of calibration cycle*/
WriteByteToAd7799(0x08);
/* Writes to Communications Register Setting Next Operation as Write to Mode Register*/
WriteByteToAd7799(0xA0);
WriteByteToAd7799(0x0A);
/* Writes to Mode Register Initiating Internal Full-Scale Calibration*/
//WaiteRDY();
// _delay_ms(5);
/* Wait for RDY pin to go low to indicate end of calibration cycle*/
WriteByteToAd7799(0x08);//b0000 1000
/* Writes to Communications Register Setting Next Operation as Write to Mode Register*/
WriteByteToAd7799(0x00); //00010000
WriteByteToAd7799(0x0A); //00001111 (16.7HZ65dB)
{
WriteByteToAd7799(0x10); //b0001 0000
/* Writes to Communications Register Setting Next Operation as Write to CONFIGURATION Register*/
WriteByteToAd7799(0x37); //B0011 0111
WriteByteToAd7799(0x30); //B0011 0000
/*CONFIGURATION REGISTER[00,BO(0),U/B(0),0(0),G2(1),G1(1),G0(1),0,0,REF_DET(0),BUF(1),0(0),CH2(0),CH1(0),CH0(0)]*/
WriteByteToAd7799(0x08);
//b0000 1000
/* Writes to Communications Register Setting Next Operation as Write to Mode Register*/
WriteByteToAd7799(0x80);
WriteByteToAd7799(0x0A);
/* Writes to Mode Register Initiating Internal Zero-Scale Calibration*/
//WaiteRDY();
_delay_ms(5);
/* Wait for RDY pin to go low to indicate end of calibration cycle*/
WriteByteToAd7799(0x08);
/* Writes to Communications Register Setting Next Operation as Write to Mode Register*/
WriteByteToAd7799(0xA0);
WriteByteToAd7799(0x0A);
/* Writes to Mode Register Initiating Internal Full-Scale Calibration*/
//WaiteRDY();
// _delay_ms(5);
/* Wait for RDY pin to go low to indicate end of calibration cycle*/
WriteByteToAd7799(0x08);//b0000 1000
/* Writes to Communications Register Setting Next Operation as Write to Mode Register*/
WriteByteToAd7799(0x00); //00010000
WriteByteToAd7799(0x0A); //00001111 (16.7HZ65dB)
/* Mode Register[MD2(0),MD1(0),MD0(0),PSW(0),0(0),0(0),0(0),0(0),(0),(0),0(0),0(0),FS3(1),FS2(0),FS1(1),FS0(0)]*/
/* Continuous-Conversion Mode. Fadc=16.7HZ;*/
}
一周热门 更多>