Digital pot 257 steps - confused!


Closed Thread
Results 1 to 2 of 2
  1. #1
    Join Date
    Mar 2009
    Posts
    653

    Default Digital pot 257 steps - confused!

    Well, after a bit of to-ing & fro-ing, I've managed to get my digital pot controlled via a PIC using SPI.

    One puzzlement disappears (how to get SPI working), but another one surfaces ........... I bought a 257 position pot (an MCP44251 - http://ww1.microchip.com/downloads/e...Doc/22060b.pdf ) *But* check this out.

    If I send this...

    command = %00000000 (ie a write command)
    r_value = %111111111 (ie 'a wiper value of 255' or just 2 away from the 257 step maximu value) I see this...



    (green trace is the input to the pot, yellow trace is the wiper out)

    In other words, the signal is nowhere near maximum?

    If I send it this...

    command = %00000001
    r_value = %10000000

    It gets a little bigger...




    I *can* actually get the wiper output signal to maximum (ie output = to the input signal) by sending this to the pot...

    command = %00000010
    r_value = %00000000

    So bearing in mind the data byte is 8 bits... it appears that this digipot also uses 2 bits from the command byte - that's 10 bits....so how come 257 steps?

    What gives?!!

    And also the fact that it uses 8 bits in a data (wiper value) byte...but also 2 bits from the command byte (least signifcant bits) ....that's got my head spinning how I approach controlling the pot in practise? (ie with the wiper control bits breaching byte boundaries) What's the std here?!!
    Last edited by HankMcSpank; - 9th September 2010 at 00:43.

  2. #2
    Join Date
    Mar 2009
    Posts
    653


    Did you find this post helpful? Yes | No

    Default

    ok, i'M burning the midnight oil - and after spending ages on this problem, almost the minute after I posted here i sorted it.

    Here was the offender (on my PIC)..

    Code:
    SSPSTAT.6 = 0
    it should be SSPSTAT.6 = 1 ....... I reckon that due to that setting (clock edge to tx data on) my digipot was therefore missing a data bit ...which essentially offset the data I was sending it. (which didn't cause a knockon effect to the command byte, because the digipot SPI control bits are i the middle of the first byte sent & were all zeros)
    Last edited by HankMcSpank; - 9th September 2010 at 01:50.

Members who have read this thread : 0

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

Posting Permissions

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