| Table of contents |
BYTE dscDACodeToVoltage(DSCB board, DSCDASETTINGS dasettings, DSCDACODE dacode, DFLOAT *voltage);
| Name | Description |
|---|---|
| board | The board handle |
| dasettings | DA settings used when the sample was taken |
| dacode | DA code to be converted |
| voltage | Pointer to the variable which will hold the converted voltage |
Error code or 0.
ERRPARAMS errparams;
DSCDASETTINGS dasettings;
DSCB dscb;
DSCDACODE dacode;
DFLOAT voltage;
BYTE result;
/* Board initialization code omitted */
dasettings.polarity = BIPOLAR;
dasettings.load_cal = TRUE;
dasettings.range = 10.0;
if ((result = dscDAConvert(dscb, 0, dacode)) != DE_NONE)
{
dscGetLastError(&errparams);
fprintf(stderr, "dscDAConvert failed: %s (%s)\n",
dscGetErrorString(result), errparams.errstring);
return result;
}
if ((result = dscDACodeToVoltage(dscb, dasettings, dacode, &voltage)) != DE_NONE)
{
dscGetLastError(&errparams);
fprintf(stderr, "dscDACodeToVoltage failed: %s (%s)\n",
dscGetErrorString(result), errparams.errstring);
return result;
}
printf("DA code converted: %d, Actual voltage: %5.3lfV\n", dacode, voltage);
This page was last modified 00:28, 7 Aug 2004.
Copyright (c) 2004 Diamond Systems. All Rights Reserved.