| Table of contents | 
BYTE dscADCodeToVoltage(DSCB board, DSCADSETTINGS adsettings, DSCSAMPLE adcode, DFLOAT *voltage);
| Name | Description | 
|---|---|
| board | The board handle | 
| adsettings | AD settings used when the sample was taken | 
| adcode | AD code to be converted | 
| voltage | Pointer to the variable which will hold the converted voltage | 
Error code or 0.
    ERRPARAMS errparams;
    DSCADSETTINGS adsettings;
    DSCB dscb;
    DSCSAMPLE sample;
    DFLOAT voltage;
    BYTE result;
    /* Board initialization code omitted */
    if ((result = dscADSample(dscb, &sample)) != DE_NONE)
    {
        dscGetLastError(&errparams);
        fprintf(stderr, "dscADSample failed: %s (%s)\n", 
                dscGetErrorString(result), errparams.errstring);
        return result;
    }
    if ((result = dscADCodeToVoltage(dscb, adsettings, sample, &voltage)) != DE_NONE)
    {
        dscGetLastError(&errparams);
        fprintf(stderr, "dscADCodeToVoltage failed: %s (%s)\n", 
                dscGetErrorString(result), errparams.errstring);
        return result;
    }
   printf("Sample readout: %hd, Actual voltage: %5.3lfV\n", sample, voltage); 
 
 This page was last modified 19:42, 17 Jun 2004.
Copyright (c) 2004 Diamond Systems.  All Rights Reserved.