help using SHIFTOUT to control SPI digital potentiometer


Results 1 to 7 of 7

Threaded View

  1. #2


    Did you find this post helpful? Yes | No

    Default Re: help using SHIFTOUT to control SPI digital potentiometer

    I believe you need to send a command byte before your data. I have never used this chip,
    but have used a MCP42010. The digi-pot needs to know if you are reading or writing to it. Look at page 47 data sheet it is showing a 16bit command/data format.
    It would probably be easy to send two bytes in a row while the CS line is low. First byte would be your
    command byte and second your 8bit variable. Even if its only seven bits you need to send a zero to pad the 8th bit etc

    Code:
    PORTC.0 = 0
    SHIFTOUT PORTC.1, PORTC.2, 1, [constant\8]
     SHIFTOUT PORTC.1, PORTC.2, 1, [variable\8]
     PORTC.0 = 1
    
     PAUSE 100

    Here is an example sending two bytes, no need for bits
    http://www.picbasic.co.uk/forum/show...light=MCP42010

    or like this
    Code:
    PORTC.0 = 0
    SHIFTOUT PORTC.1, PORTC.2, 1, [constant,variable]
    
     PORTC.0 = 1
    
     PAUSE 100
    Last edited by mark_s; - 14th May 2015 at 23:18. Reason: add link

Similar Threads

  1. Digital potentiometer ICs (common)
    By rajultra in forum mel PIC BASIC
    Replies: 3
    Last Post: - 25th February 2014, 00:59
  2. Using SPI and Shiftout together
    By Christopher4187 in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 2nd May 2013, 10:19
  3. Replace a potentiometer by a digital pot
    By flotulopex in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 5th November 2007, 07:52
  4. Microchip MCP41xxx Digital Potentiometer Code Trouble
    By CocaColaKid in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 31st August 2005, 18:21
  5. Replies: 9
    Last Post: - 30th August 2005, 06:33

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