Shop OBEX P1 Docs P2 Docs Learn Events
ADC Driver version 2.0 — Parallax Forums

ADC Driver version 2.0

Bobb FwedBobb Fwed Posts: 1,119
edited 2010-02-14 19:46 in Propeller 1
I have just released version 2.0 of my Microchip ADC driver. There are a few minor updates, but a major update is the added support for 2 and 1 channel ADCs. So now supported is 8, 4, 2, and 1 channel ADCs in both 10- and 12-bit spec (I believe that is the whole MCP3X0X line up). Some things were changed to allow one object to use multiple supported ADCs in any combination; this was done by moving some of the constants into parameters (probably the way it should have been from the beginning).

Download the new version here: obex.parallax.com/objects/488/

Please post any comments, questions, or future addition requests here.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
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 make strings the bane of the Propeller, bend them to your will!

Comments

  • mdaveymdavey Posts: 14
    edited 2010-02-13 23:37
    Can this object be used at 80Mhz, as in _CLKMODE = XTAL1 + PLL16X not the PLL4X used in the sample? I've done some testing and it doesn't seem to work at 80Mhz. Is there another object that will work with a MCP3202 at 80Mhz.
  • Bobb FwedBobb Fwed Posts: 1,119
    edited 2010-02-14 01:24
    I tested the driver at frequencies including and between 5MHz and 100MHz. There is another driver. Just search "3202" in the obex. Can you post the code you are using (especially the call to the start method). Let me know what it is doing. In what way is it not working? Also, try your setup at lower frequencies to find out if it is a software/speed issue or something else. At above 40MHz the driver runs at faster than the datasheet specifications, but I have yet to have a ADC IC that still didn't operate.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    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!
    Fast Inter-Propeller Comm - Fast communication between two propellers (1.37MB/s @100MHz)!
  • mdaveymdavey Posts: 14
    edited 2010-02-14 14:13
    I'm just using the example code that came with the object. It was working fine and I was about to incorporate it into the rest of the system I was working on and noticed the CLKMODE difference. When I changed it to PLL16X, it stopped working. So I kept working with the example code and testing it at the higher speed. It works with PLL1X, PLL2X, and PLL4X. But not with PLL8X or PLL16X.

    The only changes I had was to the pin numbers:
    Vclk_p = 13
    Vn_p = 14
    Vo_p = 14
    Vcs_p = 27

    the : CLKMODE
    _CLKMODE = XTAL1 + PLL16X

    and the start:
    ADC.start(Vo_p, Vn_p, Vclk_p, Vcs_p, 2, 2, 12, 1)

    I also changed the channels in the example so that is was reading channel 1. I all works and comes back with correct reading with PLL4X but a change to PLL16X returns zeros for all the readings. Seeing that you have tested it to 100MHz then my guess is it's something noise related in my circuits. The MCP3202 is not on the board with the Prop so there is about 18" of wire between them. I'm also sharing the data in and out on one pin.

    Because my needs for this were rather simple, and didn't need to be fast, I put together an all Spin version that works fine. Not nearly as featured or flexible as yours, but it's working for what I needed. Thanks for getting back to me.
  • Bobb FwedBobb Fwed Posts: 1,119
    edited 2010-02-14 17:38
    There is one other thing you could try if you want to use the driver. If you open up the driver code and scroll down to the PASM section. You will find a NOP that is commented out. You can try uncommenting it, and/or add a few of them.
    If that doesn't work, sorry I couldn't help. It could very well be the distance causing problems. When I did my testing the ICs were never further than 4 or 5 cm.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    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!
    Fast Inter-Propeller Comm - Fast communication between two propellers (1.37MB/s @100MHz)!
  • mdaveymdavey Posts: 14
    edited 2010-02-14 19:46
    Bobb

    Thanks for the help but adding the NOP didn't help. I haven't put a scope on it but there is a lot going on between the Prop and the ADC, so noise is likely a big issue. I'm sure I will be using the object for other things in the future and I'll keep that in mind when I do.
Sign In or Register to comment.