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