OME-A-826PG Software Manual [Win 95/98/NT]
2.2.3 A826U.BAS
Attribute VB_Name = "A826u"
'*-----------------------------------------------------*
'* Return voltage value or -100.0 if any error occurs *
'* or parameter is out of range. *
'* Gain : 0-3
'*-----------------------------------------------------*
Function A826_AD2F(ByVal hex As Integer, ByVal Gain As Integer) As Single
Dim ZeroBase, BullRange, VoltageRange As Single
ZeroBase = 0#
FullRange = 32767#
VoltageRange = 10#
Gain = Gain Mod 16
If Gain < 0 Or Gain > 3 Then
A826_AD2F = -100#
Exit Function
End If
A826_AD2F = ((((hex - ZeroBase) / FullRange) * VoltageRange) / (2 ^ Gain))
End Function
2.2.4 The VB Demo Result:
Date: Aug-15-2000 Ver: 2.2 Page 21