mcp41*** Microchip Digital Pot


+ Reply to Thread
Page 1 of 5 123 ... LastLast
Results 1 to 10 of 49

Thread: mcp41*** Microchip Digital Pot4770 days old

  1. #1
    BenBarber
    Guest BenBarber's Avatar

    1 Not allowed!

    Default mcp41*** Microchip Digital Pot

    Hi,
    Has anyone used the MCP41*** Digital Pot from Microchip. It has an SPI interface and I am guessing that this is addressed via the SHOUT command. Is this correct?
    If anyone has a short code snip that they could share I would appreciate it.
    Thanks so much,
    Ben

  2. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  3. #2
    lubo_
    Guest lubo_'s Avatar

    0 Not allowed!

    Default

    Hi BenBarber

    This is an working code :
    '----------------------------------------------------------------------
    Device=16F873

    XTAL = 20

    ALL_DIGITAL = True

    Symbol CS10 = PORTB.5 ' chip select
    Output CS10 ' Set CS10 to output

    Symbol SCK = PORTC.3 ' Clock pin
    Symbol SI = PORTC.4 ' Data in pin
    Symbol SO = PORTC.5 ' Data out pin

    Dim i As Byte
    Dim VAR1 As Byte

    VAR1 = 0

    LOOP:
    For i = 0 To 255
    VAR1 = i
    GoSub write_dig_pot ' Write 10k dig pot
    DelayMS 100
    Next
    GoTo LOOP
    '================================================= ========
    write_dig_pot:

    CS10=0 ' Enable

    SHOut SI, SCK, msbfirst, [$11,VAR1]

    CS10=1
    CS10=0
    CS10=1

    Return

    End

  4. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  5. #3
    lubo_
    Guest lubo_'s Avatar

    0 Not allowed!

    Default

    Forgot to say

    Remove the line -> Symbol SO = PORTC.5 ' Data out pin.
    This one was used for another task in my full project.

    So, the connections are:

    PORTB.5 <-> CS pin of MCP41XXX
    PORTC.3 <-> SCK pin of MCP41XXX
    PORTC.4 <-> SI pin of MCP41XXX

    Regards

  6. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  7. #4
    BenBarber
    Guest BenBarber's Avatar

    0 Not allowed!

    Default

    Hi Lubo,
    Thanks for the code snippet. It looks pretty straight forward.
    I will give this a try tonight.
    Ben

  8. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  9. #5
    hamamimed
    Guest hamamimed's Avatar

    0 Not allowed!

    Default Re: mcp41*** Microchip Digital Pot

    very good is working

  10. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  11. #6
    Fanatical Contributor top204's Avatar
    Join Date
    Feb 2002
    Posts
    3,305
    Thumbs Up
    Received: 382
    Given: 138
    Total Downloaded
    1.60 GB

    0 Not allowed!

    Default Re: mcp41*** Microchip Digital Pot

    Go to the beta section of the forum and download the pre-release of the latest compiler. In the "Samples\New_Samples" folder you'll find the file MCP42xxx_Digital_Resistor.bas. This implements an interface to the MCP41xxx and MCP42xxx digital resistors.

  12. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  13. #7
    Kapitan
    Guest Kapitan's Avatar

    0 Not allowed!

    Default Re: mcp41*** Microchip Digital Pot

    Quote Originally Posted by Les View Post
    Go to the beta section of the forum and download the pre-release of the latest compiler. In the "Samples\New_Samples" folder you'll find the file MCP42xxx_Digital_Resistor.bas. This implements an interface to the MCP41xxx and MCP42xxx digital resistors.
    Hi Les,
    Please can you explain what you mean by

    ' Interface to an MCP41xxx or MCP42xxx digital resistor
    ' Implements a very fast (rolled out code) software SPI interface

    in the context of 'rolled out code' ?
    I am presuming this means a bypass of the shout routines etc.. so in real time, ?
    The whole area of Macros is something I have not previously explored, but am working with now in isis with extremely good results - a whole new aspect for me.
    Very interesting and very nice.
    Joe

  14. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  15. #8
    Fanatical Contributor top204's Avatar
    Join Date
    Feb 2002
    Posts
    3,305
    Thumbs Up
    Received: 382
    Given: 138
    Total Downloaded
    1.60 GB

    0 Not allowed!

    Default Re: mcp41*** Microchip Digital Pot

    Rolled out means it does not use any loops, as the bits are transferred sequentially.

    This does mean more code usage, but is the fastest method of implementing software serial.

  16. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  17. #9
    Prolific Poster hadv215's Avatar
    Join Date
    Sep 2009
    Posts
    1,125
    Thumbs Up
    Received: 105
    Given: 26
    Total Downloaded
    2.93 GB

    0 Not allowed!

    Default Re: mcp41*** Microchip Digital Pot

    I'm fully aware this is a somewhat dated thread, but I do need some help.
    I tried the samples example Les supplies
    I also tried the snippet Lubo suppplied
    I modified some arduino code from the net

    I feed the wiper into A0 to do an ADIn 0 to read the value, PB0 connected to gnd, PA0 to + 5V
    Do the default loop 0-255, but all of them result in a repeating of the values 512 and 1023

    Is there something I am missing?
    Regards, Harm

  18. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  19. #10
    Fanatical Contributor top204's Avatar
    Join Date
    Feb 2002
    Posts
    3,305
    Thumbs Up
    Received: 382
    Given: 138
    Total Downloaded
    1.60 GB

    0 Not allowed!

    Default Re: mcp41*** Microchip Digital Pot

    Try measuring the oputput voltage using a Volt meter instead of the ADC. It may be that the output of the mcp device is not correct for the ADC input. Or try a buffer op-amp between the digital resistor output and the ADC input.

    Also, try it with some DelayCs commands between the clock toggles, just in case your MCP device is not accepting high speed SPI.

    The code is rolled out so it will, essentially, work on any device and at high speed.

    The original sample program was written quite a while ago, so the lines of code:

    Xtal = 16
    Declare PLL_Req = On
    Declare Optimiser_Level = 2
    Declare Dead_Code_Remove = On


    Should just be:

    Declare Xtal = 16

    Because the compiler now defaults to optimiser level 2 and Dead_Code_Remove on for 18F devices.

    or

    Declare Xtal = 64

    If using the PIC18F25K20 device (Amicus18), because the compiler's default config fuses for that device set it for 64MHz using a 16MHz crystal.
    Last edited by top204; 4th March 2019 at 21:07.

  20. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Similar Threads

  1. Replies: 5
    Last Post: 4th September 2015, 18:34
  2. Microchip digital power seminar?
    By joantabb in forum The Lounge
    Replies: 10
    Last Post: 27th January 2010, 19:36
  3. [SOLVED !] How to control a MCP41XXX Digital Pot??
    By SOTASOTA in forum Proton Plus Compiler v3
    Replies: 0
    Last Post: 19th February 2009, 22:29
  4. I2C and AD5242 digital pot
    By jncortes in forum Proton Plus Compiler v3
    Replies: 1
    Last Post: 11th March 2008, 01:28
  5. PIC to Digital Pot
    By nullsoft in forum Proton Plus Compiler v3
    Replies: 19
    Last Post: 9th November 2006, 18:55

Members who have read this thread since 9th September 2019, 22:24 : 1

Actions :  (Set Date)  (Clear Date)

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

Tags for this Thread

Posting Permissions

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