The tcDspDacAd420 class is used to provide access to an Analog Devices AD420 digital-to-current loop converter via the MityDSP generic SPI interface. An instance of the tcDspSpi class, and an optional output latch selector and ID are provided in the constructor.
The AD420 is a single-channel 16-bit device. Data written to the device is loaded immediately.
This is a simple example of tcDspDacAd420 creation and usage:
{ unsigned int my_spi_base_addr = 0xB0000200; int myLatchID = 9; tcDspOutputLatch MyClass::myOutputLatch; tcDspSpi *MyClass::mySpi; tcDspDacAd420 *MyClass::myDac; // create access to the SPI mySpi = new tcDspSpi((void *)my_spi_base_addr); // create access to DAC on SPI address 2 myDac = new tcDspDacAd420(mySpi, myOutputLatch, myLatchID); // load DAC "data" for (i=0; i<100; i++) { // write data to the device myDac->update((unsigned short)(600 * i)); TSK_sleep(10); } : }