MCP4822 dual 12-bit Digital to Analog Converter (DAC) chip.

Dependents:   ADC2DAC

The MCP4822 is a dual 12-bit Digital to Analog Converter that is controlled via an SPI interface. It is available in PDIP, SOIC or MSOP packages. The documentation for the chip is available at Microchip's MC4822 page.

The range also includes 8 or 10-bit DACs, which this library could easily be converted to.

Files at this revision

API Documentation at this revision

Comitter:
atyeomans
Date:
Mon Mar 04 17:06:01 2013 +0000
Parent:
2:e60995ceccbd
Commit message:
Added individual shutdowns

Changed in this revision

MCP4822.cpp Show annotated file Show diff for this revision Revisions of this file
MCP4822.h Show annotated file Show diff for this revision Revisions of this file
--- a/MCP4822.cpp	Fri Feb 15 16:28:57 2013 +0000
+++ b/MCP4822.cpp	Mon Mar 04 17:06:01 2013 +0000
@@ -61,4 +61,8 @@
 
 void MCP4822::shutdownB()   {
     write(true, false, 0, true);
+}
+
+void MCP4822::chipSel(){
+    cs = !cs;
 }
\ No newline at end of file
--- a/MCP4822.h	Fri Feb 15 16:28:57 2013 +0000
+++ b/MCP4822.h	Mon Mar 04 17:06:01 2013 +0000
@@ -51,6 +51,8 @@
         void shutdownA();
         //! shut down output form channel B
         void shutdownB();
+        //! Toggle chip select pin
+        void chipSel();
     private:
         DigitalOut cs, latchpin;
         SPI spi;