PDA

View Full Version : I2c Ds1808



Peter1960
- 16th April 2007, 22:45
Hi,
Does the I2CWrite and I2CRead commands take care of the read write bit ?

The DS1808 is a dual digital potentiometer.

The command for I2C DS1808 is

Control Bits 7,6,5,4 = 0101

Address Bits 3,2,1 (A2, A1, A0)

Read Write Bit 0, ie 1 = read, 0 = write

Then the next two write/reads are data;

Bits 7,6 00 = Pot 0, 01 = Pot 1

(Courtisy of Melanie)

Example: Write ...

I2CAddress=0
I2CWrite SDA,SCL,I2CDevice,I2CAddress,[DataA]

PortA.0 con SDA ' Define Port A.0 to be the Data Line
PortA.1 con SCL ' Define Port A.1 to be the Clock Line
I2CDevice con $51 ' Device from Data sheet, leaving remaining bits 0's
DataPot0=%00xxxxxx
DataPot1=%01xxxxxx

Will the command I2CWrite take care of the write bit ?

mister_e
- 16th April 2007, 22:51
Yes indeed..... you need only 1 control byte

Peter1960
- 16th April 2007, 22:54
Thanks Mr E