LabVIEW Interface for Arduino Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

SPI using digi pot MCP41xxx/42xxx

Solved!
Go to solution

Hello all,

I am using MCP42100 digi pot for my project. I have difficulty in programing spi in labview. I installed all required software and I am sure that all the devices working fine. Still I am unable to to communicate with the pot. The attachment has a Vi I am using, kindly go throuh it and let me know my mistakes please! 

Thank you

Venki

0 Kudos
Message 1 of 11
(8,980 Views)
Solution
Accepted by topic author Venki_5s

I got it audrino_second_working.png

0 Kudos
Message 2 of 11
(4,708 Views)

You don't need to be so elaborate with building the array to send via SPI.  You can simply do this as long as both values are U8's.

command byte.png

Why are you writing to that digital pin?  The SPI command does that already within the code.

With my library (attached), you should be able to make your code as simple as this:

MCP42XXX Example.png

Try it out with my library and let me know if it works because I can't test it.  If you test it and give me feedback, Thanks for you help!

0 Kudos
Message 3 of 11
(4,707 Views)

NathanB, thanks for the vi's.great job, much cleaner!...will test it out at work. Uno is acting normal

dig pot.png

0 Kudos
Message 4 of 11
(4,707 Views)

I'm glad you like it.  Let me know the results of your tests!

0 Kudos
Message 5 of 11
(4,707 Views)

well, the chip select is not syncronized to the serial command and the pulse width (chip select) varies from 600 to 700 uSec, because of this...I cant clock 16 rises accurately...

0 Kudos
Message 6 of 11
(4,707 Views)

I'm not sure I understand any of that.  I'm using exactly the same method that Venki uses.  Also, I'm using standardized SPI protocol so I'm not sure that that is the problem.  If you are having issues with timing maybe you need to change the clock divider in the Init VI.

0 Kudos
Message 7 of 11
(4,707 Views)

I am sure it must be my configuration(user error),it will do what it was commanded to do...., otherwise there would be more complaints on this.Thanks for your help!

0 Kudos
Message 8 of 11
(4,707 Views)

thanks Nathan for the MCP41xx lib, I was able to get the digital pot working...

0 Kudos
Message 9 of 11
(4,707 Views)

That's great to hear!  Did you need to change anything in the library to get it to work?  Anything I would need to change so that it will work for everybody?

0 Kudos
Message 10 of 11
(4,707 Views)