MCP3201 problems


Closed Thread
Results 1 to 17 of 17

Hybrid View

  1. #1
    Join Date
    Dec 2008
    Location
    Ploiesti, ROMANIA
    Posts
    579

    Default MCP3201 problems

    Hi ! I tried to make an adapter for steering wheel audio controls, based on MCP3201 (since my previous tries based on PIC ADC failed, being inaccurate) . In Proteus it works fine, but in "real world" it doesn't work properly ...I can't figure out why !
    Maybe someone can point me in the right direction ! Thanks in advance !
    Attached Files Attached Files

  2. #2
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,521


    Did you find this post helpful? Yes | No

    Default Re: MCP3201 problems

    What exactly does "doesn't work properly" mean?
    What DOES it do and what do you expect it to do? Which PIC are you using and what does your hardware look like?

    You've been around here long enough to know that a simple "doesn't work" is the wrong type of problem description. At least you did post the code so thumbs up for that ;-)

    Give us something to work with. Does the PIC run at all? Does it run at the desired speed? Do you have control over the output pins? Is it a specific routine that doesn't work as expected. Basic stuff like that....

    /Henrik.

  3. #3
    Join Date
    Dec 2008
    Location
    Ploiesti, ROMANIA
    Posts
    579


    Did you find this post helpful? Yes | No

    Default Re: MCP3201 problems

    Thanks for reply !
    I attached iin my first post the Proteus simulation and the pbp file ... I used 16F676 for "driving" six resistors (for Sony players); MCP3201 must read the valiues of the steering wheel commands. But no matter what button I press, there are only two or three commands of six (Vol +, Source and seek+) and sometimes the same button does one of the three commands, randomly...
    Attached Images Attached Images  
    Last edited by fratello; - 3rd December 2017 at 17:59.

  4. #4
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,521


    Did you find this post helpful? Yes | No

    Default Re: MCP3201 problems

    Yes, I saw that but not everyone is fortunate to have Protues and the there are basically no comments in the code as to what the intention of it is nor for which processor it's intended. But now we know :-)

    Do you have the serial display in the actual prototype as well? In that case you can determine if the values are being read correctly and the logic is at fault OR if the problem is either with the code reading the ADC or possibly with the hardware itself.

    Speaking of hardware, I don't see a single decoupling capacitor in the schematic. Things like that may fly in simulation, seldom in real life.

    The code seems to decode the the expected ADC reading values correctly but what does it do when a value does NOT match one of the cases? For example if adc_res is 700? I think you should set b_level to 0 at the start of the routine. Not that THAT neccesarily is the problem but still....

    Also, I think you should "release" the CS pin as soon as you've done shifiting in the data.

    /Henrik.

  5. #5
    Join Date
    Dec 2008
    Location
    Ploiesti, ROMANIA
    Posts
    579


    Did you find this post helpful? Yes | No

    Default Re: MCP3201 problems

    Thanks again !
    I have 100 nF capacitors near to power pins of PIC and MCP ... I use a Sony player for tests ; I don't have a serial display.
    As I said, my previous attempts (using PIC ADC) worked very fine in Proteus, worked very fine "on work table", but not so well on the car : sometimes the buttons wouldn't react properly (maybe because of automotive environment ?).
    I used LM2931-CZ5 for power supply, 100 nF ceramic capacitors, even a 100 uH coil before the voltage regulator. The part of code which reads the values of ADC is the same in this code...

  6. #6
    Join Date
    Aug 2011
    Posts
    412


    Did you find this post helpful? Yes | No

    Default Re: MCP3201 problems

    There isn't 16 bits of data to read, so the adc_RES parameter will have to be adjusted after you shift in the data.
    Even if you change it to not read 16-bits you should mask out the first few bits read since they are undefined.

    See section 6.1 in the MCP3201 datasheet.

  7. #7
    Join Date
    Jan 2014
    Posts
    84


    Did you find this post helpful? Yes | No

    Default Re: MCP3201 problems

    Hello Fratello,

    Sounds like a hardware issue. I worked with LM2931 and i had some strange problems because I used a lower capacitance on output. Connect a 100uF (0,1uF is too low) near the stab pack on output line. "On work table" all are ok because may be you use a power supply who have a big capacitance. Also, when pic works with signals its necessary to decoupling with 10uF capacitance.

  8. #8
    Join Date
    Dec 2008
    Location
    Ploiesti, ROMANIA
    Posts
    579


    Did you find this post helpful? Yes | No

    Default Re: MCP3201 problems

    Thanks ....but I have already FULL decoupling...Name:  decoupling.jpg
Views: 616
Size:  31.7 KB

  9. #9
    Join Date
    Sep 2010
    Location
    Las Vegas, NV
    Posts
    305


    Did you find this post helpful? Yes | No

    Default Re: MCP3201 problems

    Just curious if the symptoms change when the RPM is varied?

  10. #10
    Join Date
    Dec 2008
    Location
    Ploiesti, ROMANIA
    Posts
    579


    Did you find this post helpful? Yes | No

    Default Re: MCP3201 problems

    Nope ! No change !

Similar Threads

  1. Shiftin problem (16f877A with MCP3201)
    By financecatalyst in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 17th November 2013, 03:10
  2. IF ....THEN.... problems
    By bursach in forum mel PIC BASIC Pro
    Replies: 16
    Last Post: - 24th February 2011, 19:42
  3. New and I'm having problems!
    By Roddy Wayne in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 12th April 2009, 06:38
  4. IR problems
    By Snap in forum General
    Replies: 10
    Last Post: - 6th August 2007, 06:20
  5. A/D Problems!
    By scottl in forum General
    Replies: 4
    Last Post: - 20th May 2006, 15:49

Members who have read this thread : 2

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