MCP4922 SPI interface Example code
Dependencies: mbed
Diff: main.cpp
- Revision:
- 1:02e36b65d214
- Parent:
- 0:e33f65054b23
diff -r e33f65054b23 -r 02e36b65d214 main.cpp --- a/main.cpp Mon Oct 29 18:16:05 2018 +0000 +++ b/main.cpp Tue Oct 30 17:47:56 2018 +0000 @@ -1,20 +1,20 @@ #include "mbed.h" - -/* +/********************** * MCP4922 - */ + **********************/ + ///SPI Interface SPI MCP4922_SPI(D11,D12,D13);//MOSI ,MISO ,SCK DigitalOut MCP4922_CS(D10);//CS + //Digital Output DigitalOut MCP4922_LDAC(D8); DigitalOut MCP4922_SHDN(D9); - int main() { /****************************** - *setup + ***** setup ******* ******************************/ /////////setup SPI////////// @@ -36,13 +36,11 @@ //loop while(1) { - - - /* + /****************************************************************************** * Set DAC output channal A @ 2.5v Vref = 3.3v , DAC 12 bit ,Gain =0, Unbuffer * So DAC data = 3103 * SPI data format CH,BUF,GA,SHDN,DATA[12:0] - */ + ******************************************************************************/ /////prepare Data to tranfer///// //create data buffer