DS1803 digital pot - can't get it working!


Closed Thread
Results 1 to 4 of 4
  1. #1
    Join Date
    Mar 2011
    Location
    cape town, south africa
    Posts
    19

    Default DS1803 digital pot - can't get it working!

    I'm having problems with the DS1803 010 (10Kohm) digital pot.

    This is simply a test circuit - ultimately I'd like to use the device to alter the brightness of a LED. Problem is, the simple circuit doesn't work. I have a feeling it may be an address issue. Any help from those more experienced would be greatly appreciated!

    code and circuit diagram;Name:  circuit diagram.jpg
Views: 2626
Size:  204.0 KB

    Code:
    Button1 var portb.7     ' low is pressed
    led1 var portb.6
    SDA VAR portc.2
    SCL VAR portc.3
    
    B0 var word
    
    LOOP:
    
    '***************** VARY POT OVER RANGE **********************
    FOR B0 = 1 TO 255
    I2CWRITE SDA, SCL, %01010000, %10101111, [B0]
    PAUSE 10 ' Wait =>10 mS for write to complete
    IF B0 = 255 THEN LOOP
    NEXT B0
    
    '************************************************************
    GOTO LOOP 
    
    end

  2. #2
    Join Date
    Oct 2005
    Location
    Loveland CO USA
    Posts
    83


    Did you find this post helpful? Yes | No

    Default Re: DS1803 digital pot - can't get it working!

    The 2nd word, "command" should be 101010xx where xx=which pot.
    Why"IF B0 = 255 THEN LOOP"?


    Quote Originally Posted by orjon1 View Post
    I'm having problems with the DS1803 010 (10Kohm) digital pot.

    This is simply a test circuit - ultimately I'd like to use the device to alter the brightness of a LED. Problem is, the simple circuit doesn't work. I have a feeling it may be an address issue. Any help from those more experienced would be greatly appreciated!

    code and circuit diagram;Attachment 5308

    Code:
    Button1 var portb.7     ' low is pressed
    led1 var portb.6
    SDA VAR portc.2
    SCL VAR portc.3
    
    B0 var word
    
    LOOP:
    
    '***************** VARY POT OVER RANGE **********************
    FOR B0 = 1 TO 255
    I2CWRITE SDA, SCL, %01010000, %10101111, [B0]
    PAUSE 10 ' Wait =>10 mS for write to complete
    IF B0 = 255 THEN LOOP
    NEXT B0
    
    '************************************************************
    GOTO LOOP 
    
    end

  3. #3
    Join Date
    Mar 2011
    Location
    cape town, south africa
    Posts
    19


    Did you find this post helpful? Yes | No

    Default Re: DS1803 digital pot - can't get it working!

    Hi Ron,

    Thanks - that line you point out is indeed unnecessary.

    However, the 2nd command word, which I have at "%10101111" is the correct command to write to both pots according to the datasheet.

    Very frustrating!

  4. #4
    Join Date
    Mar 2011
    Location
    cape town, south africa
    Posts
    19


    Did you find this post helpful? Yes | No

    Default Re: DS1803 digital pot - can't get it working!

    Hi Ron,

    Solved the problem - the value being written was a variable of type "word", where it needs to be a byte.

    Thanks for your assistance.
    -orjon.

Members who have read this thread : 1

You do not have permission to view the list of names.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts