06-14-2012 02:20 PM
Hello, everyone. I have problems with using Arduino with MCP4822 through SPI. 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
.
But it doesn't work. I connect CS with pin 10, SDI with pin 11, SCK with pin13.
Could anyone help me?
Thank you
06-14-2012 06:33 PM
Why don't you let the Arduino take care of the conversion. i.e. Send a high level command from Labview (you will have to add an extra case statement to the switch structure in LabVIEWInterface.ino)
Take a look at this post which walks you through this process.
Note that there is already Arduino support for the MCP4822. Google it. I have not verified how good it is though.
Good luck.
Dale
06-14-2012 07:07 PM
Hi, Dale,
Thanks for your this and former reply. After your last reply, I checked out the MCP4822 library written by one guy. It is awesome. I could set up the 12bit voltage(0-4095) from arduino and output that. But, in my project, I need to chage that value realtime from LabVIEW. So, I need to input the SPI command from LabVIEW. I got this idea from arduino forum. At first we use PWM output, and we could control time duty. But Arduino's PWM is 8-bit, which cannot meet our requirment. So we move to SPI. Now I think my problem is at Data Send componet. I know how to send that in arduino. However, there is no specific example or introduction on SPI.