A826u.cpp (for bcb), 3 a826u.cpp, Bcb) – Omega Engineering OME-A826PG User Manual
Page 15: 3 a826u.cpp (for bcb)
OME-A-826PG Software Manual [Win 95/98/NT]
2.1.3
A826U.Cpp (for BCB)
#include
//*-----------------------------------------------------*
//* Return voltage value or -100.0 if any error occurs *
//* or parameter is out of range. *
//* HiLo : 1 --> High Gain , 0 --> Low Gain *
//*
Gain
:
0-3
*
//*-----------------------------------------------------*
float A826_AD2F(Word hex, int Gain )
{
float ZeroBase, VoltageRange, FullRange ;
short int i ;
ZeroBase = 0.0 ;
FullRange = 32767.0 ;
VoltageRange = 10.0 ;
i = hex ;
Gain = Gain % 16;
if ( (Gain < 0) || (Gain > 3) )
return -100.0;
return ((((i - ZeroBase) / FullRange) * VoltageRange) / pow( 2 , Gain));
}
Date: Aug-15-2000 Ver: 2.2 Page 13