MCP4822 dual 12-bit Digital to Analog Converter (DAC) chip.
MCP4822 Class Reference
MCP4822 dual 12-bit DAC. More...
#include <MCP4822.h>
Public Member Functions | |
MCP4822 (PinName dataout, PinName clock, PinName chipselect, PinName latch) | |
Create an MCP4822 instance. | |
void | setA (float voltage) |
Set output A to voltage. | |
void | setB (float voltage) |
Set output B to voltage. | |
void | set (float voltageA, float voltageB) |
Set both output A to voltageA and outputB to voltageB. | |
void | latch () |
Latch the stored values to the output pins. | |
void | shutdown () |
shut down output from the DAC chip | |
void | shutdownA () |
shut down output form channel A | |
void | shutdownB () |
shut down output form channel B | |
void | chipSel () |
Toggle chip select pin. |
Detailed Description
MCP4822 dual 12-bit DAC.
- Version:
- 1.1
LICENSE
The MIT License (MIT) Copyright (c) 2013 Nick Ryder, Andrew Yeomans
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Definition at line 31 of file MCP4822.h.
Constructor & Destructor Documentation
MCP4822 | ( | PinName | dataout, |
PinName | clock, | ||
PinName | chipselect, | ||
PinName | latch | ||
) |
Create an MCP4822 instance.
- Parameters:
-
dataout SPI MOSI pin (should be p5 or p11) clock SPI clock pin (should be p7 or p13) chipselect SPI chip select pin (can be any) latch Latch pin updates the DAC out. Can be any pin or NC, if NC then the latch pin on the DAC chip should be held to GND.
Definition at line 3 of file MCP4822.cpp.
Member Function Documentation
void chipSel | ( | ) |
Toggle chip select pin.
Definition at line 66 of file MCP4822.cpp.
void latch | ( | ) |
Latch the stored values to the output pins.
Definition at line 34 of file MCP4822.cpp.
void set | ( | float | voltageA, |
float | voltageB | ||
) |
Set both output A to voltageA and outputB to voltageB.
Definition at line 19 of file MCP4822.cpp.
void setA | ( | float | voltage ) |
Set output A to voltage.
Definition at line 11 of file MCP4822.cpp.
void setB | ( | float | voltage ) |
Set output B to voltage.
Definition at line 15 of file MCP4822.cpp.
void shutdown | ( | ) |
shut down output from the DAC chip
Definition at line 53 of file MCP4822.cpp.
void shutdownA | ( | ) |
shut down output form channel A
Definition at line 58 of file MCP4822.cpp.
void shutdownB | ( | ) |
shut down output form channel B
Definition at line 62 of file MCP4822.cpp.
Generated on Thu Jul 21 2022 04:01:51 by 1.7.2