Controlling a MCP4162 Digital Pot


Closed Thread
Results 1 to 6 of 6
  1. #1
    Join Date
    Jan 2009
    Posts
    50

    Default Controlling a MCP4162 Digital Pot

    Help!
    I would like to control Microchip's MCP4162 Digital Pot with a PIC16F84a using PIC Basic Pro.
    I have this code so far. The Digital Pot is a 256 tap pot. I want to set it to any tap position. Blow I am trying to set it to tap 128 just to get it working. But, nothing happens.

    'Set these B ports O/P and LOW
    Input PORTB.0 'Pushbutton
    High PORTB.1 'ChipSelect
    Low PORTB.2 'SCK
    Low PORTB.3 'SDI

    PORTB.1=0 'ChipSelect
    ShiftOut PORTB.3, PORTB.2, 1, [128]
    PORTB.1=1 'ChipSelect

  2. #2
    lllfsss2's Avatar
    lllfsss2 Guest


    Did you find this post helpful? Yes | No

    Default has esto..

    'Set these B ports O/P and LOW
    Input PORTB.0 'Pushbutton
    High PORTB.1 'ChipSelect
    Low PORTB.2 'SCK
    Low PORTB.3 'SDI

    PORTB.1=0 'ChipSelect
    ShiftOut PORTB.3, PORTB.2, 1, [$00,$128]
    PORTB.1=1 'ChipSelect

    eso porque primero tienes que mandarle el codigo del wiper que vas a usar
    y luego le mandas el valor variable que usaras!

  3. #3
    Join Date
    Feb 2004
    Location
    Michigan, USA
    Posts
    305


    Did you find this post helpful? Yes | No

    Default

    So did you ever get this to work?

  4. #4
    Join Date
    Feb 2004
    Location
    Michigan, USA
    Posts
    305


    Did you find this post helpful? Yes | No

    Default

    A little confusion.

    Looking at the shiftout section of the pbp manual, mode is selectable with a simple 0 to 3 depending an your needs.

    Past code examples include this line:

    Code:
    WriteOnPot0
    Does the newer version of pbp take care of this now with the mode setting or is this still required at the start of the program?

  5. #5
    Join Date
    Feb 2004
    Location
    Michigan, USA
    Posts
    305


    Did you find this post helpful? Yes | No

    Default

    More confusion. If you set the commandbyte to a constant, you wont be able to increment or decrement because the control byte is always set for one or the other. Therefore, shouldnt the commandbyte be sent at the same time the data is sent?

    Example if the pot is currently sitting at position 200 and the commandbyte is %00000101 and you send:

    PORTB.1=0 'ChipSelect
    ShiftOut PORTB.3, PORTB.2, 1, [$00,$128]
    PORTB.1=1 'ChipSelect


    Nothing will happen because the pot is set to only increment.


    OR am I getting this completely wrong and the $00 is the commandbyte? This would put 00 at the increment/decrement bits which is a READ condition, therefore any value sent after the $00 would be placed on the pot.
    If that is the case, there is no need for the commandbyte constant.

  6. #6
    Join Date
    Feb 2004
    Location
    Michigan, USA
    Posts
    305


    Did you find this post helpful? Yes | No

    Default Re: Controlling a MCP4162 Digital Pot

    Any help with this?

Similar Threads

  1. Digital Pot
    By TONIGALEA in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 3rd January 2012, 07:54
  2. Digital Pot Advice
    By Tobias in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 22nd October 2007, 20:38
  3. Replies: 4
    Last Post: - 24th January 2007, 22:20
  4. Serial control of a digital pot?
    By TonyA in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 2nd June 2006, 23:49
  5. Controlling A Digital Pot
    By TonyA in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 27th April 2006, 21:30

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