PS_Fgen_FW  4da88f4073c1cc65ea45c3a652a2751e495e50db
Firmware for an Power Supply and Function Generator build from an ATX power supply
Loading...
Searching...
No Matches
DAC_MCP492x.h File Reference

Containing the functions to control the MCP492x DACs. More...

#include "../Pins/Pins.h"
#include "../Configuration.h"

Go to the source code of this file.

Macros

#define MCP492X_DACB   7
 Position of the DACA or DACB Select bit in the write command register.
 
#define MCP492X_BUFFERED   6
 Position of the VREF Input Buffer Control bit in the write command register.
 
#define MCP492X_GAIN_SELECT_SINGLE   5
 Position of the Output Gain Select bit in the write command register.
 
#define MCP492X_SHDN   4
 Position of the Output Power Down Control bit in the write command register.
 
#define SELECT_MCP4922   SPI_SELECT_DDS
 Select the MCP4922 DAC by pulling the DDS_CS pin low.
 
#define DESELECT_MCP4922   SPI_DESELECT_DDS
 Deselect the MCP4922 DAC by pulling the DDS_CS pin high.
 
#define SELECT_MCP4921   SPI_SELECT_PS
 Select the MCP4921 DAC by pulling the PS_CS pin low.
 
#define DESELECT_MCP4921   SPI_DESELECT_PS
 Deselect the MCP4921 DAC by pulling the PS_CS pin high.
 

Functions

void MCP4921_DAC_Set (uint16_t dac_data)
 Set the DAC data value of the MCP4921 device.
 
void MCP4921_Voltage_Set (float voltage)
 Set the voltage of the MCP4921 device.
 
void MCP4922_DAC_Set (uint16_t dac_data, char channel_A_B)
 Set the DAC data value of the MCP4922 device.
 
void MCP4922_Voltage_Set (float voltage, char channel_A_B)
 Set the voltage of the MCP4922 device.
 

Detailed Description

Containing the functions to control the MCP492x DACs.

Date
31.08.2020 18:43:02
Author
Markus Scheich

Function Documentation

◆ MCP4921_DAC_Set()

void MCP4921_DAC_Set ( uint16_t dac_data)

Set the DAC data value of the MCP4921 device.

Parameters
dac_dataDAC data that is written to the write command registers. Only the lower 12 bits are used.

◆ MCP4921_Voltage_Set()

void MCP4921_Voltage_Set ( float voltage)

Set the voltage of the MCP4921 device.

The voltage is converted to the DAC data using the calibrated reference voltage of the device.

Parameters
voltageSet the MCP4921 device to this voltage.

◆ MCP4922_DAC_Set()

void MCP4922_DAC_Set ( uint16_t dac_data,
char channel_A_B )

Set the DAC data value of the MCP4922 device.

Parameters
dac_dataDAC data that is written to the write command registers. Only the lower 12 bits are used.
channel_A_BSet this to 'B' to set the value of the second channel (B). All other characters set the value of the first channel (A).

◆ MCP4922_Voltage_Set()

void MCP4922_Voltage_Set ( float voltage,
char channel_A_B )

Set the voltage of the MCP4922 device.

The voltage is converted to the DAC data using the calibrated reference voltage of the device.

Parameters
voltageSet the MCP4922 device to this voltage.
channel_A_BSet this to 'B' to set the value of the second channel (B). All other characters set the value of the first channel (A).