Serial control of a digital pot?


Results 1 to 8 of 8

Threaded View

  1. #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