wiki:warpdac_ad9775.c

Version 25 (modified by andreat, 18 years ago) (diff)

--

Analog Devices AD9775 Control Library


Full Code

warpdac_ad9775.c
This file provides functions for controlling the WARP radio board's DAC chip.

Documentation

Functions

For all functions the input variable baseaddr is the base address of the SPI Core and dacs is the 16 bit hex value where the 8 least significant bits are the value to be stored and the 8 most significant bits choose the register in which to store the value.

void transmitdac(unsigned int* baseaddr, int val)
Transmits a value to a register. val a 16 bit hex value where the 8 least significant bits are the value to be stored and the 8 most significant bits choose the register in which to store the value.

void WarpDac_InitializeSPI(unsigned int* baseaddr)
Initializes the SPI controller for DAC functions. This function must be called before calling any other DAC functions.

void WarpDac_InitializeDAC(unsigned int* baseaddr, unsigned char dacs)
This function must be called at the beginning of the program to make necessary changes in some of the registers. Initializes the DACs specified in dacs.

void WarpDac_Reset(unsigned int* baseaddr, unsigned char dacs)
Resets the DAC registers to their default values. Calls WarpDac_InitializeDAC, so there is no need to repeat it in the code.

int WarpDac_Sleep(unsigned int* baseaddr, char mode, unsigned char dacs)

int WarpDac_FineGainAdj(unsigned int* baseaddr, char chan, unsigned char value, unsigned char dacs)

int WarpDac_CoarseGainAdj(unsigned int* baseaddr, char chan, unsigned char value, unsigned char dacs)

int WarpDac_OffsetAdj(unsigned int* baseaddr, char chan, short value, unsigned char dacs)