/* --------------------------------------------------------------------------- * dac.h - v0.1 (c) 2007 Micro-key bv * --------------------------------------------------------------------------- * Micro-key bv * Industrieweg 28, 9804 TG Noordhorn * Postbus 92, 9800 AB Zuidhorn * The Netherlands * Tel: +31 594 503020 * Fax: +31 594 505825 * Email: support@microkey.nl * Web: www.microkey.nl * --------------------------------------------------------------------------- * Description: Digital to analog signal interface. * --------------------------------------------------------------------------- * Version(s): 0.1, 10-09-2007, Marcel Mulder. * Creation. * --------------------------------------------------------------------------- */ #ifndef __DAC_H__ #define __DAC_H__ /** \file dac.h \brief Digital to analog signal interface. */ /* --------------------------------------------------------------------------- * System include files. * --------------------------------------------------------------------------- */ #include "lpc23xx.h" #include "types.h" /* --------------------------------------------------------------------------- * Application include files. * --------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------- * Constant and macro definitions. * --------------------------------------------------------------------------- */ /** Maximum number of real analog channels*/ // \MARK NEW PINSETTINGS FOR TESTER (2) #if (PINSET_TESTER == 2) #define maxDAC_Channels 6 #else #define maxDAC_Channels 4 #endif #define maxDAC_VOLTAGE (10000) #define maxDAC_CURRENT (20000) /* --------------------------------------------------------------------------- * Type definitions. * --------------------------------------------------------------------------- */ typedef enum { dacVOLTAGE, /**< Voltage mode 0 to 10V */ dacCURRENT /**< Current mode 0 to 20mA */ } t_dac_mode; /* --------------------------------------------------------------------------- * Variable declarations. * --------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------- * Function declarations. * --------------------------------------------------------------------------- */ /** \brief Initialize DAC.*/ void dacInit (void); void dac_MuxEn (BOOLEAN mode); BOOLEAN dac_MuxRB (void); /** \brief Select input mode (Voltage or Current) of a certain channel. */ void dacMode( UINT8 channel, /**< 0..3 = valid, 8..255 = future use */ t_dac_mode mode ); /** \brief Write analog value in mV or uA depending on dacMode */ void dacWrite( UINT8 device, /**< 0 = Self, 1..32 = Remote device */ UINT8 channel, /**< 0..3 = valid, 8..255 = future use */ UINT16 value /**< VOLTAGE: 0..10000[mV], CURRENT: 0..20000[uA] */ ); /** \brief Read analog value in mV or uA depending on dacMode \retval value VOLTAGE: 0..10000[mV], CURRENT: 0..20000[uA] */ UINT16 dacReadBack ( UINT8 device, /**< 0 = Self, 1..32 = Remote device */ UINT8 channel /**< 0..3 = valid, 8..255 = future use */ ); void WriteDacCommand( UINT16 spiCommand, UINT8 dacNr ); void dacModeAll (t_dac_mode mode); #endif /* __DAC_H__ */