/***************************************************************
 * PrDACTRC.h
 *
 * This is a TRC D/A converter class.
 *
 ****************************************************************/

/*
 * modification history
 *----------------------
 *
 * 10/26/97: K.C. Chang: created.
 */

#ifndef _PrDACTRC_h
#define _PrDACTRC_h

#include "PrDriverIntf.h"

class PrDACTRC : public PrDriverIntf
{
 public:
    // constructor sets flag
    // flag() should be called before using
    PrDACTRC();
    ~PrDACTRC();

    // hardware reset: calls value() with zero for all channels
    virtual int zero();

    // write a channel value to 'volt': calls WriteValue()
    virtual int value(int channel,Float &volt);

 private:
    Float *offsetVolt_;

    // convert volts to bits with limits
    unsigned int VoltsToBits(int channel,Float volt);

    // returns the hw address of channel
    int ChannelToAddress(int channel);

    // writes the bits to the hw address
    int WriteValue(int address,unsigned int bits);    

    // copy is not allowed
    PrDACTRC(const PrDACTRC &) {}
};

#endif // _PrDACTRC_h

