Go Down

Topic: Arduino with MCP4822 through SPI (Read 2262 times) previous topic - next topic


Hello, everyone. I have problems with using Arduino with MCP4822 through SPI in LabVIEW. Above pic is my VI. MCP 4822's command is 16-bit.
Bit 15: DACa or DACb select
Bit 14: dont't care
Bit 13: Output Gain bit
Bit 12: Output Power-Down Control Bit
Bit 11-0:: DAC data bits.
In my project, I need to set up D11-D0 to get an ouput voltage with 12 bit resolution. Here is my command

Could anyone help me? Thank you


The integer "2" means word size.


Is it the formulating of the bits to turn on and off that you are having difficulty with?

With the chip in "high" (2x) gain mode the value placed in the lower 12 bits is the voltage you will get.  In "low" (1x) gain mode you will get half the voltage.

The voltage is specified in millivolts, so just convert the number of millivolts you want into binary and enter those digits.  For example, 659mV in 12-bit binary is:


with bit 11 being on the left and bit 0 on the right.  So your whole command would be:


for channel A in 2x gain mode and "active" (not shut down).

Go Up