Class for AD7390, a 12 bit SPI driven external DAC from Analog Devices.

Dependencies:   mbed

Datasheet - http://www.analog.com/static/imported-files/data_sheets/AD7390_7391.pdf

AD7390.cpp

Committer:
cassar10
Date:
2014-04-05
Revision:
0:82cd70f9fc3f
Child:
1:19818c103c9c

File content as of revision 0:82cd70f9fc3f:

# include "AD7390.h"

AD7390::AD7390(PinName data, PinName clock, PinName resetpin, PinName latchpin, float RefV) : //Mosi, sclk 2x digital out refV
    reset(resetpin), latch(latchpin), spi(data, NC, clock)
    {
        //Vout = (Vref*D)/2^n
        spi.format(12,0);
        latch = 1;      //Pull low to pass shift register to DAC register
        reset = 1;      //Pull low to reset 
    }
    
    void AD7390::Reset()        //Reset ADC to 0V by pulling reset pin low
    {
        reset = 0;
        wait_us(25);
        reset = 1;              //Set back to high so it can be written to again
    }
    void AD7390::Latch()        //Latch data from shift register to DAC
    {
        latch = 0;
        wait_us(25);
        latch = 1;
    }