Pamux User’s Guide 99
PAMUX UTILITY OPERATIONS
The following utility functions are provided primarily for Visual Basic applications. These are not
Pamux-specific functions.
Bit Operations (PamuxUtilBitSetTo, PamuxUtilBitSet, PamuxUtilBitClr, PamuxUtilBitTest)
PROTOTYPES:
void PamuxUtilBitSetTo(UINT far* pData, UINT BitNumber0, BOOL
bBitValue);
void PamuxUtilBitSet(UINT far* pData, UINT BitNumber0);
void PamuxUtilBitClr(UINT far* pData, UINT BitNumber0);
BOOL PamuxUtilBitTest(UINT Data, UINT BitNumber0);
DESCRIPTION:
These bit operations are useful in Visual Basic applications to access individual
bits within an integer. The BitSetTo function either sets or clears the specified bit
based on the value of bBitValue. Any non-zero value for Data will turn on
the bit. The BitSet and BitClr functions set and clear the specified bit. Bit numbers
start at zero for the least significant bit (LSB). The zero at the end of the
parameter name “BitNumber0” serves as a reminder of this fact for anyone
looking through the function definitions in either the .BAS file or the .H header
files. PamuxUtilBitTest returns true if bit number BitNumber0 in Data is set.
Scaling Operations (PamuxUtilScaleI2I, PamuxUtilScaleI2F, PamuxUtilScaleF2F,
PamuxUtilScaleF2I)
PROTOTYPES:
int PamuxUtilScaleI2I(int X1, int X2, int Y1, int Y2, int Xin);
float PamuxUtilScaleI2F(int X1, int X2, float Y1, float Y2, int
Xin);
float PamuxUtilScaleF2F(float X1, float X2, float Y1, float Y2,
float Xin);
int PamuxUtilScaleF2I(float X1, float X2, int Y1, int Y2, float
Xin);
DESCRIPTION:
These interpolation functions are useful for converting between engineering units and raw
analog counts. Pamux analog input and output values range between 0 and FFF hex (4,095
decimal). These values typically correspond to engineering units, such as pH and psi. For
example, to convert raw counts (from 0 to FFF hex) to a percentage, use:
float fPercent=PamuxUtilScaleI2F(0,0xFFF,0F,100.F,nRawCount);
PROGRAMING WITH THE PAMUX DRIVER