lolxnano
Code to control the LoLX SiPM biasing board from the connected nanoPi
Loading...
Searching...
No Matches
AD56x6 Class Referenceabstract

Parent class containing methods common to AD5666, AD5676, and AD5686 DAC chips. More...

#include <ad56x6.h>

Inheritance diagram for AD56x6:
Collaboration diagram for AD56x6:

Public Member Functions

 AD56x6 (NanoPi &np, int cs)
 Constructor.
 
unsigned char * AssembleWord (uint8_t cmd, uint8_t chan, uint16_t *data=NULL)
 Assembles the SPI word from command, channel, and data.
 
bool Set (unsigned short chan, uint16_t setting, bool confirm=true)
 Sets the selected DAC channel to a value, confirms with readback.
 
virtual uint16_t GetSetting (double v, unsigned short chan=0)=0
 Translates analog voltage to DAC setting, requires calibration.
 
virtual double GetVoltage (uint16_t s, unsigned short chan=0)=0
 Translates DAC setting to analog voltage, requires calibration.
 
bool RampVoltage (unsigned short chan, uint16_t vset=-1, unsigned int steps=16, unsigned int tdelay=500)
 Test method to ramp through voltage settings.
 
void PowerOn ()
 Send POWER_UP command to DAC.
 
uint16_t GetData ()
 Extract 16 bit setting from readback word.
 
void Readback (short ch=-1)
 Read back DAC settings and write them to vector readback.
 

Public Attributes

const uint16_t vfull = 0xffff
 Full scale output.
 
const uint8_t nbytes = 3
 Size of data word in bytes.
 
std::vector< uint16_t > readback
 Read back DAC settings after Readback() was called.
 

Protected Member Functions

virtual uint8_t EncChan (uint8_t chan)
 Format channel number for use in SPI word (3-bit number)
 

Protected Attributes

uint32_t bits = 0
 
NanoPinanoPi = NULL
 
const int cselect
 
bool verbose = false
 

Detailed Description

Parent class containing methods common to AD5666, AD5676, and AD5686 DAC chips.

This contains everything needed for the SPI communication with an AD56x6 DAC chip, except for those parts that differ between chips.

Constructor & Destructor Documentation

◆ AD56x6()

AD56x6::AD56x6 ( NanoPi & np,
int cs )
inline

Constructor.

Parameters
npAn instance of a NanoPi object, needed for the actual hardware communication
csSPI channel select addressing the chip in question

Member Function Documentation

◆ GetSetting()

virtual uint16_t AD56x6::GetSetting ( double v,
unsigned short chan = 0 )
pure virtual

Translates analog voltage to DAC setting, requires calibration.

Implemented in AD5676, and AD5686R.

◆ GetVoltage()

virtual double AD56x6::GetVoltage ( uint16_t s,
unsigned short chan = 0 )
pure virtual

Translates DAC setting to analog voltage, requires calibration.

Implemented in AD5676, and AD5686R.

◆ RampVoltage()

bool AD56x6::RampVoltage ( unsigned short chan,
uint16_t vset = -1,
unsigned int steps = 16,
unsigned int tdelay = 500 )

Test method to ramp through voltage settings.

Only used for functionality tests, not that useful for general use.

Parameters
chanchannel number
vsetmaximum setting, use -1 to go to full scale
stepsnumber of steps between 0 and vset
tdelaymilliseconds to wait between steps

◆ Readback()

void AD56x6::Readback ( short ch = -1)

Read back DAC settings and write them to vector readback.

Parameters
chchannel to read back, -1 reads all channels

The documentation for this class was generated from the following files: