Library for MCP4822 SPI 12-bit DAC, both outputs supported, nLDAC connected to GND.

Dependents:   MCP4822_2aLerche

Embed: (wiki syntax)

« Back to documentation index

MCP4822 Class Reference

MCP4822 Class Reference

Interface to a 12-bit SPI dual-output DAC. More...

#include <MCP4822.h>

Public Member Functions

 MCP4822 (PinName mosi, PinName sclk, PinName ncs)
 Constructor: MCP4822.
void writeA (int ValueA)
 Write to the A-output, max 4095 (0xFFF) with 1 mV steps.
void writeB (int ValueB)
 Write to the B-output, max 4095 (0xFFF) with 1 mV steps.
void write (char chan, int value)
 Write to any output, accoding to letter.
void shdn ()
 Shutdown the output on specific channel.

Detailed Description

Interface to a 12-bit SPI dual-output DAC.

Definition at line 29 of file MCP4822.h.


Constructor & Destructor Documentation

MCP4822 ( PinName  mosi,
PinName  sclk,
PinName  ncs 
)

Constructor: MCP4822.

Parameters:
MOSI- The SPI Data out pin
SCLK- The SPI clock pin
/CS- The ChipSelect pin

Definition at line 28 of file MCP4822.cpp.


Member Function Documentation

void shdn (  )

Shutdown the output on specific channel.

Definition at line 85 of file MCP4822.cpp.

void write ( char  chan,
int  value 
)

Write to any output, accoding to letter.

Definition at line 55 of file MCP4822.cpp.

void writeA ( int  ValueA )

Write to the A-output, max 4095 (0xFFF) with 1 mV steps.

Parameters:
ValueAThe value to be written

Definition at line 37 of file MCP4822.cpp.

void writeB ( int  ValueB )

Write to the B-output, max 4095 (0xFFF) with 1 mV steps.

Parameters:
ValueBThe valkue to be written

Definition at line 46 of file MCP4822.cpp.