Pages: [1]   Go Down
Author Topic: Arduino with MCP4822 through SPI  (Read 1477 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 15
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


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
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 15
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The integer "2" means word size.
Logged

UK
Offline Offline
Faraday Member
**
Karma: 99
Posts: 4153
Where is your SSCCE?!?!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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:

001010010011

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

0001001010010011

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

Get 10% off all 4D Systems TFT screens this month: use discount code MAJENKO10

Pages: [1]   Go Up
Jump to: