digital pot

Hi, anyone with experience with the ds1267 digital pot could post so;e code ? http://www.datasheetcatalog.net/datasheets_pdf/D/S/1/2/DS1267.shtml

or at least tell me how I can write 17bits out of the arduino....

Hi,

or at least tell me how I can write 17bits out of the arduino....

I would use the shiftOut()-function. A call to shiftOut() will always send 8 bits but that should be no problem since SPI-devices don't care how many bits are shifted in they just use whatever data is in their registers when the transmission is finshed. In your case that should be when Signal /RST goes from HIGH to LOW. So for the 17 bits you send 3 bytes (24bits) where the first 7 bits are only dummys. They are sort of shifted through the device falling out of the rear end of the pot ...

I don't have any working code for you (don't have the hardware) but it should look something like this here.

//only the LSB of this value counts, Upper 7 bits are just dummys
byte stackSelect=0; //or 1 I don't know.  see datasheet
byte wiper1=B0101010; //Wiper-data
byte wiper0=B1010101;

digitalWrite(YourResetPin,HIGH);
shiftOut(YourDataPin,YourClockPin,MSBFIRST,stackSelect);
shiftOut(YourDataPin,YourClockPin,MSBFIRST,wiper1);
shiftOut(YourDataPin,YourClockPin,MSBFIRST,wiper0);
//now load the data shifted out into the device
digitalWrite(YourResetPin,LOW);
//and pull to high for next round
digitalWrite(YourResetPin,HIGH);

Eberhard

thank you very much for your reply. It make sense to me now.I ws just ensure about the fact that the device would just "not care" about the extra bits as it.s wrtitten in the datasheet that it has to be 17bits.

thanks again