3.6.1.6 Calculate the A/D Value
The demo program to calculate the real A/D value is given as follows:
double ComputeRealValue(DWORD dwAdConfig, DWORD dwAdHex)
{
WORD wZERO;
double dfMAX, dfVal;
switch (dwAdConfig)
{ case 0 : wZERO=2048; dfMAX=5.0; break;
case 1 : wZERO=2048; dfMAX=2.5;
break;
case 2 : wZERO=2048; dfMAX=1.25; break;
case 3 : wZERO=2048; dfMAX=0.625; break;
case 4 : wZERO=2048; dfMAX=10.0; break;
case 5 : wZERO=2048; dfMAX=5.0;
break;
case 6 : wZERO=2048; dfMAX=2.5;
break;
case 7 : wZERO=2048; dfMAX=1.25; break ;
case 8 : wZERO= 0; dfMAX=10.0/2.0; break;
case 9 : wZERO= 0; dfMAX=5.0/2.0;
break;
case 10: wZERO= 0; dfMAX=2.5/2.0;
break;
case 11: wZERO= 0; dfMAX=1.25/2.0; break;
case 0x10 : wZERO=2048; dfMAX=5.0;
break;
case 0x11 : wZERO=2048; dfMAX=0.5;
break;
case 0x12 : wZERO=2048; dfMAX=0.05; break;
case 0x13 : wZERO=2048; dfMAX=0.005; break;
case 0x14 : wZERO=2048; dfMAX=10.0; break;
case 0x15 : wZERO=2048; dfMAX=1.0;
break ;
case 0x16 : wZERO=2048; dfMAX=0.1;
break;
case 0x17 : wZERO=2048; dfMAX=0.01; break;
case 0x18 : wZERO= 0; dfMAX=10.0/2.0; break ;
case 0x19 : wZERO= 0; dfMAX=1.0/2.0; break;
case 0x1A : wZERO= 0; dfMAX=0.1/2.0; break;
case 0x1B : wZERO= 0; dfMAX=0.01/2.0; break;
Note: B4=0 is used
to identify PGL
Note: B4=1 is used to
identify PGH
1202/1800/1802H
For PCI-
For PCI-1202/1800/1802L
default: return(ConfigCodeError); }
dfVal=(((double)(wAdHex)-wZERO)/2048.0)*dfMAX;
return(dfVal);
}
PCI-1202/1602/1800/1802 Hardware User’s Manual
(Ver. 4.2, Dec/2009, PMH-014-42)---- 43