Skip to main content
1 of 2

MCP4131 with 8 - bit

I am using MCP4131 with 7 - bit ( 0 - 128 ). Datasheet said that, it can work bit 7 and 8 bit and i definetly need to use it with 8 bit ( 0 - 256 ). Here is my code below;

#include <SPI.h>
byte address = 0x00;
int CS= 10;
void setup()
{
pinMode (CS, OUTPUT);
SPI.begin();

}
void loop()
{
digitalPotWrite(50);
}

int digitalPotWrite(int value)
{
digitalWrite(CS, LOW);
SPI.transfer(address);
SPI.transfer(value);
digitalWrite(CS, HIGH);
}

This is 7 bit code, to make it 8 bit, What should i change in the code ? Or what i need to do ?

Thank You Best Regards