ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW Interface for Arduino Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

Labview with MCP4822 SPI

QQ截图20120614141148.jpg

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

QQ截图20120614141802.jpg.

But it doesn't work. I connect CS with pin 10, SDI with pin 11, SCK with pin13.

Could anyone help me?

Thank you

0 Kudos
Message 1 of 3
(6,640 Views)

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

Message 2 of 3
(3,913 Views)

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.

0 Kudos
Message 3 of 3
(3,913 Views)