Using MCP41HXV1 (DIGI POT 6 CLICK) can't change wiper

Dear Everyone.

I'm Using MCP41HXV1 (DIGI POT 6 CLICK) with Arduino Leonardo.

DataSheet of this chipset is https://docs.rs-online.com/be55/A700000007461615.pdf

I connected with 5V , Gnd with Arduino leonardo.

and

CS to digital pin 10
SCK to digital pin 13
SDO to digital pin 11
SDI to digital pin 12.

I'v got Library for MCP41HVX1(created by gregsrabian/Github) and using these library.

I just try to wiper_control example.

Create instance like below

#define CS_PIN 10

MCP41HVX1 Digipot( CS_PIN);

but i can't change wiper value in any circumstances.

here is my code.

any advice?

#include <MCP41HVX1.h>

// Define the pins used on the Arduino
#define WLAT_PIN 8
#define SHDN_PIN 9
#define CS_PIN 10

// Define some values used for the test app
#define FORWARD true
#define REVERSE false
#define MAX_WIPER_VALUE 255

MCP41HVX1 Digipot( CS_PIN);

int nWiper;
bool bDirection = FORWARD;

void setup ()
{
Serial.begin(115200);

while (!Serial) {
  ; // wait for serial port to connect. Needed for Leonardo only
}

nWiper = Digipot.WiperSetPosition(0x00);

Serial.print( "Starting Position = ");
Serial.println( Digipot.WiperGetPosition());  

Serial.print( "Set Wiper Position = ");
Serial.println( nWiper);  // Set the wiper position to 0

}

void loop ()
{

nWiper = Digipot.WiperGetPosition();  // Get the current wiper postion from the digipot

// Determine the direction. Either counting up starting at 0 or counting down starting at max (max is either 127 or 255 depending on the digipot used)
if( MAX_WIPER_VALUE == nWiper)
{
  bDirection = REVERSE;
}
else if( 0 == nWiper)
{
  bDirection = FORWARD;
}

// Move the digipot wiper
if( FORWARD == bDirection)
{
  nWiper = Digipot.WiperIncrement();    // The direction is forward so increment the wiper position on the digipot
  Serial.print( "Increment - ");
}
else
{
  nWiper = Digipot.WiperDecrement();    // The direction is backward so decrement the wiper position on the digipot
  Serial.print( "Decrement - ");
}

Serial.print( "Wiper Position = ");
Serial.println( nWiper);

delay(1000);

}

I've tried the code below.

digitalWrite(CS_PIN, LOW );
SPI.transfer(0x00); // The command for wiper set position
SPI.transfer(80); // The write command expects a second byte which is the value for the wiper
digitalWrite(CS_PIN, HIGH);

wiper value is still 0. not changed..

should be IMHO

CS to digital pin 10
SCK to digital pin 13
SDI to digital pin 11
SDO to digital pin 12.

hope that helps...

Sorry. it was just misstyping.

I connected

CS to 10
SCK to 13
SDO to 11
SDI to 12

even i changed

CS to 10
SCK to 13
SDI to 11
SDO to 12

the result was same.

there is a library already available for this chip. maybe try it out...

https://github.com/gregsrabian/MCP41HVX1

hope that helps....

i found out.

Leonardo has different pin for IPS connect.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.