MCP4822 dual 12-bit Digital to Analog Converter (DAC) chip.
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.
Revision 2:e60995ceccbd, committed 2013-02-15
- Comitter:
- NickRyder
- Date:
- Fri Feb 15 16:28:57 2013 +0000
- Parent:
- 1:68b3a24fd2a4
- Child:
- 3:7484c0fe6f4d
- Commit message:
- Add functions to shut down the two channels separately.
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 Wed Feb 13 16:14:58 2013 +0000 +++ b/MCP4822.cpp Fri Feb 15 16:28:57 2013 +0000 @@ -53,4 +53,12 @@ void MCP4822::shutdown() { write(false, false, 0, true); write(true, false, 0, true); +} + +void MCP4822::shutdownA() { + write(false, false, 0, true); +} + +void MCP4822::shutdownB() { + write(true, false, 0, true); } \ No newline at end of file
--- a/MCP4822.h Wed Feb 13 16:14:58 2013 +0000 +++ b/MCP4822.h Fri Feb 15 16:28:57 2013 +0000 @@ -5,7 +5,7 @@ /** MCP4822 dual 12-bit DAC * @author NickRyder, atyeomans -* @version 1.0 +* @version 1.1 * @section LICENSE * The MIT License (MIT) * Copyright (c) 2013 Nick Ryder, Andrew Yeomans @@ -47,6 +47,10 @@ void latch(); //! shut down output from the DAC chip void shutdown(); + //! shut down output form channel A + void shutdownA(); + //! shut down output form channel B + void shutdownB(); private: DigitalOut cs, latchpin; SPI spi;