Shop OBEX P1 Docs P2 Docs Learn Events
ADC 12 Bit 3202-B ADC — Parallax Forums

ADC 12 Bit 3202-B ADC

CenlasoftCenlasoft Posts: 265
edited 2009-11-09 23:15 in Propeller 1
Hello,
I downloaded the 12 bit ADC object and tried the code. I don't have a joystick, but I used a 10k pot on channel 0 with 3.3 v and ground. (wiper to channel 0). I commented out the average line and I only get the number 24 as a result. I looked at the datasheet and tried to understand the configuration of %0011 in the MCP3202.start function. Can someone explain how to get a single channel (0) running for now? Can I use a pot to test the object?
Thanks,
Curtis

Comments

  • StefanL38StefanL38 Posts: 2,292
    edited 2009-10-26 18:14
    I compared the datasheets of the MCP308 with the MCP3202

    there seems to be a slight difference in the serial communication

    see attached pictures

    dataheets:
    MCP3202

    MCP3208

    best regards

    Stefan
    1142 x 799 - 65K
    1095 x 651 - 57K
  • CenlasoftCenlasoft Posts: 265
    edited 2009-10-26 18:41
    Hello,
    Thanks for the help.
    I found the problem, the pins had to be P0, P1, and P2. I guess they are SPI pins only. Now I will see if I can change the %0011 to where I can use only channel 0.
    Thanks,
    Curtis
  • StefanL38StefanL38 Posts: 2,292
    edited 2009-10-26 21:13
    No that is surely NOT the problem.
    ALL Propeller-IO-pins are general-purpose IO-PINS

    The Pins 30,31 and wich are used for download programs and Pins 28,29 wich are connected to the EEPROM
    are a little bit different but just because some pull-up-resistor are connected to the IO-pins.

    If you take a naked propeller-chip all 32-IO-pins work the exact same way

    So maybe something inside the code was not matching. From a hardware-sight all IO-pins are the same

    best regards

    Stefan
  • John AbshierJohn Abshier Posts: 1,116
    edited 2009-10-26 21:41
    I had problems with this driver and posted updated code. I did not update the object exchange since it was not my object. Here is a link
    http://forums.parallax.com/forums/default.aspx?f=25&m=387025

    John Abshier
  • CenlasoftCenlasoft Posts: 265
    edited 2009-10-29 02:08
    Thanks John,
    I'll try it and let you know.
    Curtis
  • CenlasoftCenlasoft Posts: 265
    edited 2009-10-31 21:30
    John,

    Your modifications to the object allowed the use of pins other than 0,1,and 2. I still cannot get it to work on two channels. It works for either channel but gives me an (11) for one channel for a 2 channel configuration.

    Great work,

    Curtis
  • HarpritHarprit Posts: 539
    edited 2009-11-07 21:25
    Take a look at the SPIN code I posted for reading the 3202
    in Propeller Object exchange. Search 3202.
    It goes over the communications a bit at a time and might
    help you understand what is going on.
    Reading two channels should be no harder than reading one
    channel. Try reading them one at a time first back and
    forth and get that going first.

    Harprit
  • CenlasoftCenlasoft Posts: 265
    edited 2009-11-08 16:25
    Thanks Harprit,

    I will look at it. The original object that I downloaded worked great on both channels, but it had to use pins 0,1, and 2. The object·I got from·John Abshier worked on any pin, but I could not get it to work with both channels. The 3202 is a great IC and would like to use it in my projects with one or two channels.

    Thanks,

    Curtis
  • John AbshierJohn Abshier Posts: 1,116
    edited 2009-11-08 17:12
    I just checked out the chip and it worked with both channels.· Attached is complete project with driver and test program.· Inputs were connected to the pots on the Professional Development Board.

    John Abshier
  • CenlasoftCenlasoft Posts: 265
    edited 2009-11-09 02:27
    Thanks John,
    It works, but can I change the PLL4X ?
    Curtis
  • John AbshierJohn Abshier Posts: 1,116
    edited 2009-11-09 05:28
    I had not noticed the PLL4X. PLL16X has problems. I think PLL8X will work. I tried a quick fix without looking at the chip data sheet but it didn't work all the time. The error I get is a reading off by a factor of 10 or 100. For example if the value most of the time is 3057, there will occasionally be a reading of 305 or 30. Sorry.

    John Abshier
  • John AbshierJohn Abshier Posts: 1,116
    edited 2009-11-09 16:29
    I think the last code I attached works at 16X. I think the problem I was seeing was caused by the latency setting of my USB port. Changing it from 16 to 1 seems to have fixed the problem. Give it a try at 16X and let me know if it works.

    John Abshier
  • CenlasoftCenlasoft Posts: 265
    edited 2009-11-09 17:27
    Thanks John.

    I'll try it this afternoon and I will let you know.

    Curtis
  • Bobb FwedBobb Fwed Posts: 1,119
    edited 2009-11-09 23:15
    Try the driver I have in my signature (below). It works on 8, 4, 2, and 1 channel Microchip ADCs in both 10- and 12-bit.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    April, 2008: when I discovered the answers to all my micro-computational-botherations!

    Some of my objects:
    MCP3X0X ADC Driver - Programmable Schmitt inputs, frequency reading, and more!
    Simple Propeller-based Database - Making life easier and more readable for all your EEPROM storage needs.
    String Manipulation Library - Don't allow strings to be the bane of the Propeller, bend them to your will!
Sign In or Register to comment.