uint8_t OPx[50]={ 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27,
0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,
0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47,
0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57,
0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77,};
//分别对应系统放大:1,2,4,8,16,32,64,
// 2,4,8,16,32,64,128
// 4,8,16,32,64,128,256
// 8,16,32,64,128,256,512
// 16,32,64,128,256,512,1024
// 32,64,128,256,512,1024,2048
// 64,128,256,512,1024,2048,4096
//LTC6912-2 PGA增益设置
void LTC6912_SetGain(uint16_t xGain)
{
uint8_t gtemp=0;
switch(xGain)
{
case 1:
gtemp=0;
break;
case 2:
gtemp=1;
break;
case 4:
gtemp=2;
break;
case 8:
gtemp=3;
break;
case 16:
gtemp=4;
break;
case 32:
gtemp=5;
break;
case 64:
gtemp=6;
break;
case 128:
gtemp=13;
break;
case 256:
gtemp=20;
break;
case 512:
gtemp=27;
break;
case 1024:
gtemp=34;
break;
case 2048:
gtemp=41;
break;
case 4096:
gtemp=48;
break;
default:
break;
}
LTC6912_SPI_SendOneByte(OPx[gtemp]); //就是普通的SPI-WRITE,1个字节
}