Serial control of a digital pot?


Closed Thread
Results 1 to 8 of 8

Hybrid View

  1. #1
    Join Date
    Apr 2006
    Posts
    92

    Default Serial control of a digital pot?

    Hi,

    I am searching for info and examples for controlling a digital pot serially using shiftout. I am using the pic18f452, and I'm not sure which digital pot to use. Any suggestions/info would be greatly appreciated.

    Thank you,
    TonyA

  2. #2
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    those i already used in the past from Microchip
    MCP42010, MCP42050,MCP42100, MCP41010,MCP41050,MCP4110.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  3. #3
    Join Date
    Apr 2006
    Posts
    92


    Did you find this post helpful? Yes | No

    Default

    Hi,

    Are there any examples of code around?

    Thanks,
    Tony

  4. #4
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    Not where i am, but i could download the datasheet and try something somewhere today.

    As i remind it wasn't too complicated. Maybe there's some example here already done. Do a search with the model i suggest, you may find something
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  5. #5
    Join Date
    Apr 2006
    Posts
    92


    Did you find this post helpful? Yes | No

    Default

    I appreciate that very much. I will try a search here.

    Thanks again,
    Tony

  6. #6
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    O.K it's untested but it should work for any MCP4XXXX digital pot. Try it and post your results
    Code:
        '
        '    Hardware configuration
        '    ======================
        TRISC=0
        
        '                      
        '    Hardware connection
        '    ===================
        CS          VAR PORTC.0
        CLK         VAR PORTC.1
        SI          VAR PORTC.2
        
        '   
        '    Variables definition 
        '    ===================
        Wiper       var byte
        
        '
        '    Constants definition 
        '    ====================
        MSBFIRST    CON 1              
        WriteOnPot0 con %00010001
    
        '
        '    Software/Hardware initialisation
        '    ================================
        cs = 1      ' disable MCP
        PAUSE 100   ' safe settle time
        
    Start:
        for wiper = 0 to 255
            cs=0                                            ' enable 
            shiftout si,clk, MSBFIRST,[WriteOnPot0, WIPER]  ' Write to MCP
            cs = 1                                          ' Disable
            pause 10                                       
            next                                           
        goto start
    Now connect PA0 too vcc, PB0 to GND and read the voltage on PW0 pin... is this working?
    Last edited by mister_e; - 2nd June 2006 at 14:53.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

Similar Threads

  1. Controlling a MCP4162 Digital Pot
    By SOTASOTA in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 6th February 2011, 18:51
  2. Digital Pot Advice
    By Tobias in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 22nd October 2007, 20:38
  3. servo control via pot ?
    By n0oxv in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 1st March 2007, 07:11
  4. Replies: 4
    Last Post: - 24th January 2007, 22:20
  5. DS1868 Digital Pot
    By ero in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 31st August 2004, 13:22

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