I'm looking for some help with an I2C problem. I am trying to write to the wiper counter register on an Intersil X9119 digipot. It works, but with a minor twist from what I would expect.
The X9119 spec says this is a four byte write, basically addr, command, msbyte, lsbyte with a STOP. If I send the stop on the last byte I get an error. If I send a dummy byte with the STOP it "seems" to work fine. I can't easily get to the wiper to measure it, so I am not positive the value is getting written.
This is a short version of the code without the error checking. The i2c_write is a Sharp library function that works on other devices. The dev_i2c is a pointer to the already open control block.
// send the address of the digipot with the write bit set
1 if ( i2c_write(dev_i2c, 0x50 , 0) != 1 )error();// send the digipot instruction and register addr
2 if ( i2c_write(dev_i2c, 0xA0, 0) != 1 )error();// Write the msbyte of the wiper position
3 if ( i2c_write(dev_i2c, 0x2, 0) != 1 )error();// Write the lsbyte of the wiper position
4 if ( i2c_write(dev_i2c, 0x55, 0) != 1 )error();5 if ( i2c_write(dev_i2c, 0x00, I2C_ICCON_SABT) != 1 )error(); // or ..., I2C_ICCON_STOP);
From what the X9119 doc and the 79524 docs say, I think step 5 is not necessary, but I get an error on that write if I put either a STOP or SABT on step 4.
An equivalent function to read the wiper fails on the first read.
Anyone have any experience or ideas on this?
Scott