7. UD Function Reference

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 DscPCIInitBoard (BYTE boardtype, DSCCBP dsccbp, DSCB board)

Initializes and sets the hardware settings of the given PCI board. Must be called once for each board before using that PCI 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.

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 (DSCB, 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

BYTE dscADSetScan (DSCB board, DSCADSCAN* dscadscan)

Sets the configuration for A/D scan settings.

BYTE dscADSetTiming (DSCB board, DscADSettings* settings)

Sets the configuration for A/D clock source and scan settings.

BYTE dscADIntStatus (DSCB board, DscADIntStatus* status)

Receives the status of A/D interrupt generated.

BYTE dscPauseOp (DSCB board)

Pause the A/D interrupt generating process.

BYTE dscResumeOp (DSCB board)

Resumes the A/D interrupt which is passed.

BYTE dscADIntCancel (DSCB board)

Cancels the A/D interrupt generated.

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 dscDASetSim (DSCB board, BOOL sim)

Configures the board for simultaneous update or regular single-channel update mode

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 dscDIOIntCancel (DSCB board)

This function is used to cancel the digital interrupts.

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 dscDIOOutputInt (DSCB board, DSCDIOINT* dscdioint)

This function installs a pointer to a user function that runs when digital interrupts occur.

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.

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 dscCounterFunction (DSCB board, DSCCR *dsccr)

Configures a counter/timer based on the all the options using user input.

BYTE dscCounterRead (DSCB board, DSCCR* dsccr)

Reads the configuration for all individual counters.

BYTE dscCounterRate (DSCB board, DSCCR* dsccr)

Sets the configuration and clock rate for all individual counters.

BYTE dscCounterConfig (DSCB board, DSCCR* dsccr)

Configures the counter registers for all individual counters.

BYTE dscCounterReset (DSCB board, BYTE Ctrno)

Resets the individual counter.

BYTE dsc9513SetMMR (DSCB board, DSCCR* dscqmmmmr)

Programs the 9513 chip Master Mode Register on GPIO-MM 11/12.

BYTE dsc9513SetCMR (DSCB board, DSCQMMCMR* dscqmmcmr)

Programs a Counter Mode Register on GPIO-MM 11/12.

BYTE dsc9513SingleCounterControl (DSCB board, BYTE counter, BYTE action)

Performs load, arm, disarm, and save actions on a single counter on GPIO-MM 11/12.

BYTE dsc9513CounterControl (DSCB board, DSCQMMMCC dscqmmmcc, BYTE status)

Performs load, arm, disarm, and save actions on a group of counters on GPIO-MM 11/12.

BYTE dsc9513SetLoadRegister (DSCB board, BYTE counter, WORD value)

Loads a value into a counter's Load register on Quartz-MM.

BYTE dsc9513SetHoldRegister (DSCB board, BYTE counter, WORD value)

Loads a value into a counter's Hold register on Quartz-MM.

BYTE dsc9513ReadHoldRegister (DSCB board, BYTE counter, WORD* value)

Reads a counter's Hold register on Quartz-MM.

BYTE dsc9513SpecialCounterFunction (DSCB board, DSCQMMSCF* dscqmmscf)

Performs special operations on a counter on Quartz-MM, including alarms, output values, and stepping.

BYTE dsc9513MeasureFrequency (DSCB board, BYTE interval, BYTE source, WORD* pulses)

Measures the frequency of an input signal on Quartz-MM.

BYTE dsc9513MeasurePeriod (DSCB board, BYTE frequency, DWORD* periods)

Measures the period of an input signal on Quartz-MM.

BYTE dsc9513PulseWidthModulation (DSCB board, DSCQMMPWM* pwm)

Generates a PWM output on Quartz-MM.

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 dscADClockConfig (DSCB board, BYTE adclk)

Configures the clock source for 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 (DSCB board, 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)

Starts execution of user interrupts.

BYTE dscUserIntRun (DSCB board, DSCUSERINT* dscuserint)

Start user interrupts when they are running in Alone mode.

Watchdog Timer Functions

BYTE dscWatchdogEnable (DSCB board, WORD wd1, BYTE wd2, SDWORD options)

Enables the watchdog timer circuit on the CPU boards supported and configures it according to the given parameters.

BYTE dscWatchdogDisable (DSCB board)

Disables the watchdog timer circuit on the CPU board.

BYTE dscWatchdogTrigger (DSCB board)

Retriggers the watchdog timer circuit on the CPU board.

BYTE dscWatchdogConfig (DSCB board, DSCWATCHDOG* watch)

Configures watchdog timer for desired operation and it does not enables the watch timer.

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.

BYTE dscWGBufferLoad (DSCB board, DSCWGCONFIG* config)

Loads the waveform data to the waveform buffer.

PWM Functions

BYTE dscPWMStart (DSCB board, DSCPWM* cmd)

Configures and starts the PWM circuit.

BYTE dscPWMClear (DSCB board, BYTE pwm_circuit)

Stops and resets the PWM circuit.

Special Functions

BYTE dscSpecialFunction (DSCB board, DSCSPECIALFUNC *func, MACRO)

Perform the special functions applicable for specific boards.

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.

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 (DSCB board, 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.

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.

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.

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, DSCDACODEdacode)

Unit conversion utility function for converting voltage to DD units.

BYTE dscEnhancedFeaturesEnable (DSCB board, BOOL enable)

Enables/disables enhanced features

BYTE dscLEDTest (DSCB board, BOOL state)

Toggles LED on/off

BYTE dscSetPage (DSCB board, BYTE page_number)

This function is used to set the particular page

BYTE dscFifoStatus (DSCB board, DSCFIFO* Fifo)

Read current status of FIFO and store all the values of structure variables.

Last updated