DigPot with AD8400ARZ1

Hi all
anyone may help me on the code to interface Arduino Uno with the digital potentiometer AD8400ARZ1?

I tried reusing the code published for MCP41010 since both chips are declared SPI-compatible, but it doesn't work. I understand the reason because the SDI messages have a different structure in the two chips, thus the instruction set

void digPotWrite(byte value)
{
digitalWrite(csPin, LOW);
SPI.transfer(B00010001);
SPI.transfer(value);
digitalWrite(csPin, HIGH);
}

cannot work on AD8400ARZ1. But I don't know how to change it.

Any help is welcome. Thanks
Bruno

based on the datasheet (https://www.analog.com/media/en/technical-documentation/data-sheets/AD8400_8402_8403.pdf) the wiper addr is set to 0x00 for this chip.

in terms of codes, possibly something like this may work (compiles, not tested!):

#include"SPI.h"

void setup (void)
{
uint8_t data;
  
  SPI.begin();
  digitalWrite(SS, HIGH);  // ensure default CS stays high for now

  for (uint16_t value = 0; value < 256; ++value) {
    data = (uint8_t) (value >> 2); //bits 7,6 are addr bits for in 1st byte transfered. (addr bits = 0)

    digitalWrite(SS, LOW);
    
    SPI.transfer(data);

    data = (uint8_t) (value << 6); //sending the bits 1,0 of 'value'

    SPI.transfer(data);

    digitalWrite(SS, HIGH);

    delay(1000); //abitrary delay to be able to observe changes in pot output
  }
}

void loop (void)
{

}

hope that helps

Thank you very much for your answer!
Actually the code doesn't work yet well on the chip, but I'm studying it to understand.
Any further suggestion is very welcome.
Bruno