DSCUD Function Reference

Universal Driver Documentation

Table of contents

Error Functions

BYTE dscGetLastError(ERRPARAMS errparams)
Returns the most recent error that occurred during a Universal Driver function call.

char* dscGetErrorString(BYTE error_code)
Returns the corresponding error string for the given error code.

Initialization Functions

BYTE dscInit(WORD version)
Initializes the Universal Driver. Must be called once at the beginning of each program.

BYTE dscFree(void)
Frees the system resources used by the universal driver. Must be called once at the end of each program. This function will automatically call dscFreeBoard for all initialized boards.

BYTE dscInitBoard(BYTE boardtype, DSCCB* dsccb, DSCB* board)
Initializes and sets the hardware settings of the given board. Must be called once for each board before using that board.

BYTE dscFreeBoard(DSCB board)
Frees the system resources used by the given board and disables any of the board's currently running interrupt operations. Must be called once for each board after finishing using that board. To free up all initialized boards call dscFree instead of this function.

Miscellaneous Functions

BYTE dscGetTime(DWORD *ms)
Get a millisecond precision clock time

BYTE dscSleep(DWORD ms)
Waits for a specified number of milliseconds.

BYTE dscGetEEPROM(DSCB board, DWORD address, BYTE* data)
Reads data from the EEPROM at the specified address.

BYTE dscSetEEPROM(DSCB board, DWORD address, BYTE data)
Writes data to the EEPROM at the specified address.

BYTE dscGetStatus(DSCB board, DSCS* status)
Returns the current status of any interrupt operations.

BYTE dscCancelOp(DSCB board)
Terminates any currently running interrupt operation.

BYTE dscCancelOpType(DSCB board, DWORD int_type)
Terminates any currently running interrupt operation.

BYTE dscInp(WORD address, BYTE *value)
Direct I/O read a byte from the address

BYTE dscInpw(WORD address, WORD *value)
Direct I/O read a word from the address

BYTE dscInpl(WORD address, DWORD *value)
Direct I/O read a double word from the address

BYTE dscInpws(WORD address, WORD *value, WORD n)
Direct I/O read n words from the address

BYTE dscOutp(WORD address, BYTE value)
Direct I/O write a byte to the address

BYTE dscOutp(WORD address, WORD value)
Direct I/O write a word to the address

BYTE dscOutpw(WORD address, WORD value)
Direct I/O write a word to the address

BYTE dscOutpl(WORD address, DWORD value)
Direct I/O write a double word to the address

BYTE dscOutpws(WORD address, WORD *buffer, WORD n)
Direct I/O write n words to the address

BYTE dscGetBoardMacro(char* boardtype, BYTE* macro)
Returns the corresponding board macro for the given board type string.

BYTE dscRegisterRead(DSCB board, WORD address, BYTE* data)
Reads a BYTE from an I/O port address.

BYTE dscRegisterWrite(DSCB board, WORD address, BYTE data)
Writes a BYTE to an I/O port address.

BYTE dscGetFPGARev(DSCB board, WORD* fpga)
Returns the FPGA revision of the board.

BYTE dscSetSystemPriority(DWORD priority)
Sets the system priority for the interrupt handling thread.

BYTE dscADCodeToVoltage(DSCB board, DSCADSETTINGS adsettings, DSCSAMPLE adsample, DWORD *voltage)
Unit conversion utility function for converting AD units to voltage.

BYTE dscVoltageToADCode(DSCB board, DSCADSETTINGS adsettings, DWORD voltage, DSCSAMPLE *adsample)
Unit conversion utility function for converting voltage to AD units.

BYTE dscDACodeToVoltage(DSCB board, DSCDASETTINGS dasettings, DSCDACODE dacode, DWORD *voltage)
Unit conversion utility function for converting DA units to voltage.

BYTE dscVoltageToDACode(DSCB board, DSCDASETTINGS dasettings, DWORD voltage, DSCDACODE *dacode)
Unit conversion utility function for converting voltage to DD units.

BYTE dscEnhancedFeaturesEnable (DSCB board, BOOL enable)
Enables/disables enhanced features

A/D Functions

BYTE dscADSetSettings(DSCB board, DSCADSETTINGS* settings)
Sets the configuration for future A/D conversions.

BYTE dscADSetChannel(DSCB board, BYTE low_channel, BYTE high_channel)
Sets the channel range for future A/D conversions.

BYTE dscADSample(DSCB board, DSCSAMPLE* sample)
Performs a single A/D conversion on the currently selected channel.

BYTE dscADSampleAvg(DSCB board, DFLOAT* sample, int count)
Performs count A/D conversions on the currently selected channel and returns the average.

BYTE dscADSampleInt(DSCBboard, DSCAIOINT* dscaioint)
Performs A/D conversions using interrupt-based I/O with one conversion per A/D clock tick.

BYTE dscADScan(DSCB board, DSCADSCAN* dscadscan, DSCSAMPLE* sample_values)
Performs a set of A/D conversions on the selected range of channels.

BYTE dscADScanAvg(DSCB board, DSCADSCAN* dscadscan, DFLOAT* sample_values, int count)
Performs count sets of A/D conversions on the selected range of channels and returns the averages for each channel.

BYTE dscADScanInt(DSCB board, DSCAIOINT* dscaioint)
Performs A/D scans using interrupt-based I/O with one scan per A/D clock tick.

D/A Functions

BYTE dscDASetSettings(DSCB board, DSCDASETTINGS* settings)
Sets the configuration for future D/A conversions.

BYTE dscDASetPolarity(DSCB board, BYTE polarity)
Sets the current software-based polarity setting for D/A conversions.

BYTE dscDAConvert(DSCB board, BYTE channel, DSCDACODE output_code)
Performs a single D/A conversion on the given channel.

BYTE dscDAConvertScan(DSCB board, DSCDACS* dscdacs)
Performs a set of D/A conversions on multiple target channels.

BYTE dscDAConvertScanInt(DSCB board, DSCAIOINT* dscaioint)
Performs D/A conversion scans using interrupt-based I/O with one scan per interrupt.

Optoinput Functions

BYTE dscOptoInputByte(DSCB board, BYTE port, BYTE * optoValue)
Simultaneously gets the state of 8 optoinputs from the board.

BYTE dscOptoInputBit(DSCB board, BYTE port, BYTE bit, BYTE* optoValue)
Gets the state of a single optoinput from the board.

BYTE dscOptoGetPolarity(DSCBboard, BYTE* polarity)
Gets the polarity of the optoinputs.

BYTE dscOptoGetState(DSCB board, DSCOPTOSTATE* state)
Gets the overall state of optoinputs from the board.

BYTE dscOptoSetState(DSCB board, DSCOPTOSTATE* state)
Sets the overall state of optoinputs on the board.

DIO Functions

BYTE dscDIOSetConfig(DSCB board, BYTE* config_bytes)
Sets the DIO port configuration for future DIO operations.

BYTE dscDIOInputByte(DSCB board, BYTE port, BYTE* digital_value)
Receives a BYTE from a given digital input port.

BYTE dscDIOOutputByte(DSCB board, BYTE port, BYTE digital_value)
Sends a BYTE to a given digital output port.

BYTE dscDIOInputBit(DSCB board, BYTE port, BYTE bit, BYTE* digital_value)
Receives a bit value from a given digital input port at a specified bit location (0-7).

BYTE dscDIOOutputBit(DSCB board, BYTE port, BYTE bit, BYTE digital_value)
Sends a bit value to a given digital output port at a specified bit location (0-7).

BYTE dscDIOSetBit(DSCB board, BYTE port, BYTE bit)
Writes a 1 to the specified bit on the specified port.

BYTE dscDIOClearBit(DSCB board, BYTE port, BYTE bit)
Writes a 0 to the specified bit on the specified port.

Relay Functions

BYTE dscSetRelay(DSCB board, BYTE relay, BYTE value)
Sets the state of one relay on the board.

BYTE dscGetRelay(DSCB board, BYTE relay, BYTE* value)
Gets the state of one relay on the board.

BYTE dscSetRelayMulti(DSCB board, BYTE relayGroup, BYTE value)
Simultaneously sets the state of multiple relays on the board.

BYTE dscGetRelayMulti(DSCB board, BYTE relayGroup, BYTE* value)
Simultaneously gets the state of multiple relays on the board.

IR104 Functions

BYTE dscIR104SetRelay(DSCB board, BYTE relay)
Sets an individual relay on an IR104 board.

BYTE dscIR104ClearRelay(DSCB board, BYTE relay)
Clears an individual relay on an IR104 board.

BYTE dscIR104RelayInput(DSCB board, BYTE relay, BYTE* value)
Reads back an individual relay's current state on an IR104 board.

BYTE dscIR104OptoInput(DSCB board, BYTE opto, BYTE* value)
Reads an individual optoisolated digital input bit on an IR104 board.

Counter Functions

BYTE dscCounterSetRate(DSCB board, float hertz)
Sets the overall clock rate by using all individual counters.

BYTE dscCounterSetRateSingle(DSCB board, float hertz, DWORD ctr)
Sets the clock rate for a specific counter or group of counters.

BYTE dscCounterDirectSet(DSCB board, BYTE code, WORD data, BYTE ctr_number)
Sets the configuration for an individual counter.

BYTE dscCounterRead(DSCB board, DSCCR* dsccr)
Reads the configuration for all individual counters.

BYTE dscQMMSetMMR(DSCB board, DSCCR* dscqmmmmr)
Programs the 9513 chip Master Mode Register on Quartz-MM.

BYTE dscQMMSetCMR(DSCB board, DSCQMMCMR* dscqmmcmr)
Programs a Counter Mode Register on Quartz-MM.

BYTE dscQMMSingleCounterControl(DSCB board, BYTE counter, BYTE action)
Performs load, arm, disarm, and save actions on a single counter on Quartz-MM.

BYTE dscQMMCounterControl(DSCB board, DSCQMMMCC* dscqmmmcc, BYTE* status)
Performs load, arm, disarm, and save actions on a group of counters on Quartz-MM.

BYTE dscQMMSetLoadRegister(DSCB board, BYTE counter, WORD value)
Loads a value into a counter's Load register on Quartz-MM.

BYTE dscQMMSetHoldRegister(DSCB board, BYTE counter, WORD value)
Loads a value into a counter's Hold register on Quartz-MM.

BYTE dscQMMReadHoldRegister(DSCB board, BYTE counter, WORD* value)
Reads a counter's Hold register on Quartz-MM.

BYTE dscQMMSpecialCounterFunction(DSCB board, DSCQMMSCF* dscqmmscf)
Performs special operations on a counter on Quartz-MM, including alarms, output values, and stepping.

BYTE dscQMMMeasureFrequency(DSCB board, BYTE interval, BYTE source, WORD* pulses)
Measures the frequency of an input signal on Quartz-MM.

BYTE dscQMMMeasurePeriod(DSCB board, BYTE frequency, DWORD* periods)
Measures the period of an input signal on Quartz-MM.

BYTE dscQMMPulseWidthModulation(DSCB board, DSCQMMPWM* pwm)
Generates a PWM output on Quartz-MM.

EMMDIO Functions

BYTE dscEMMDIOGetState(DSCB board, DSCEMMDIO* state)
Returns the current configuration for an Emerald-MM-DIO board.

BYTE dscEMMDIOSetState(DSCB board, DSCEMMDIO* state)
Sets the current configuration for an Emerald-MM-DIO board.

BYTE dscEMMDIOResetInt(DSCB board, DSCEMMDIORESETINT* resetinfo)
Resets interrupt status on an Emerald-MM-DIO board.

Calibration Functions

BYTE dscSetCalMux(DSCB board, BOOL on)
Turns the calibration multiplexer on or off.

BYTE dscAACCommand(DSCB board, DWORD cmd)
Command to start, stop, trigger, and reset auto auto-calibration.

BYTE dscAACGetStatus (DSCB board, DSCAACSTATUS* status)
Command to get status of auto auto-calibration operation and register status

BYTE dscADAutoCal(DSCB board, DSCADCALPARAMS* params)
Performs an A/D auto-calibration on a selected A/D mode or on all A/D modes.

BYTE dscDAAutoCal(DSCB board, DSCDACALPARAMS* params)
Performs a D/A auto-calibration.

BYTE dscADCalVerify(DSCB board, DSCADCALPARAMS* params)
Verifies the accuracy of the A/D calibration.

BYTE dscDACalVerify(DSCB board, DSCDACALPARAMS* params)
Verifies the accuracy of the D/A calibration.

BYTE dscGetReferenceVoltages(DSCB board, DFLOAT* refs)
Reads the reference voltages from the EEPROM.

BYTE dscSetReferenceVoltages(DSCB board, DFLOAT* refs)
Sets the reference voltages in the EEPROM.

BYTE dscDAGetOffsets(DSCB board, DFLOAT* offsets, int count)
Retrieves the D/A offsets from the EEPROM.

BYTE dscDASetOffsets(DSCB board, DFLOAT* offsets, int count)
Stores the D/A offsets into the EEPROM.

BYTE dscSetTrimDac(DSCBboard, DWORD trimDac, BYTE value)
Modifies the onboard autocalibration TrimDAC values.

User Interrupt Functions

BYTE dscSetUserInterruptFunction(DSCB board, DSCUSERINTFUNCTION* dscuserintfunction)
Installs a user interrupt function on all interrupt types in the driver for later use.

BYTE dscSetUserInterruptFunctionType(DSCB board, DSCUSERINTFUNCTION* dscuserintfunction, DWORD int_type)
Installs a user interrupt function on all interrupt types in the driver for later use.

BYTE dscClearUserInterruptFunction(DSCB board)
Uninstalls all user interrupt functions from this board.

BYTE dscClearUserInterruptFunctionType(DSCB board, DWORD int_type)
Uninstalls all user interrupt functions from this board.

BYTE dscUserInt(DSCB board, DSCUSERINT* dscuserint, DSCUserInterruptFunction func)
Starts execution of user interrupts.

Watchdog Timer Functions

BYTE dscWatchdogEnable(DSCB board, WORD wd1, BYTE wd2, SDWORD options)
Enables the watchdog timer circuit on the Prometheus CPU and configures it according to the given parameters.

BYTE dscWatchdogDisable(DSCB board)
Disables the watchdog timer circuit on Prometheus.

BYTE dscWatchdogTrigger(DSCB board)
Retriggers the watchdog timer circuit on Prometheus.

Pulse Width Modulation Functions

BYTE dscPWMLoad(DSCB board, BYTE pwm_circuit, BYTE counter, DWORD value)
Loads the specified counter of the PWM circuit with value.

BYTE dscPWMConfig(DSCB board, BYTE* config_byte)
Directly writes to the PWM configuration register.

BYTE dscPWMClear(DSCB board, BYTE pwmCircuit)
Clears/resets the PWM circuit.

BYTE dscPWMFunction(DSCB board, DSCPWM* dscpwm)
Generate or reconfigure PWM signals.

D/A Wave Form Generator Functions

BYTE dscWGCommand (DSCB board, DWORD cmd)
Function to stop, start, trigger, and reset the D/A wave form generator.

BYTE dscWGConfigSet (DSCB board, DSCWGCONFIG* config)
Sets up the D/A wave form depth, number of output per trigger, and input source.

BYTE dscWGBufferSet (DSCB board, DWORD address, DSCDACODE value, DWORD channel, BOOL simul)
Sets D/A output code for D/A wave form generator.


This page was last modified 01:47, 4 Aug 2005.
Copyright (c) 2004 Diamond Systems. All Rights Reserved.