Shop OBEX P1 Docs P2 Docs Learn Events
ADC.spin - Need help! — Parallax Forums

ADC.spin - Need help!

Brandon C.Brandon C. Posts: 106
edited 2009-09-12 04:20 in Propeller 1
I am using the wiring example here, and apparently, I can just use the ADC.spin in the propeller tool library. However, I am having a bit of trouble understanding how to use it. How can I retrieve the value?

Thanks,

Brandon C.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
No purchase necessary. See back panel for more details.

Tired of the same old robot brains? not enough processing power? Get the Propeller Robot Module now!!

Comments

  • Bobb FwedBobb Fwed Posts: 1,119
    edited 2009-09-11 23:06
    Thank PDF doesn't really tell us how you hooked up ADC to the Propeller or the input you are trying to sample to the ADC. What ADC IC are you using? A Microchip ADC or an NTE? What is the model name/number?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    April, 2008: when I discovered the answers to all my micro-computational-botherations!
  • Brandon C.Brandon C. Posts: 106
    edited 2009-09-12 00:14
    I am using a sigma-delta ADC. No IC.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    No purchase necessary. See back panel for more details.

    Tired of the same old robot brains? not enough processing power? Get the Propeller Robot Module now!!

  • Brandon C.Brandon C. Posts: 106
    edited 2009-09-12 03:31
    Sorry if I am being unclear. I have searched everywhere and cannot find any information on the ADC.spin driver in the Propeller Tool. My question is not about the wiring, but rather the programming. I do not understand how I get the A/D value from the ADC.spin so I can display it on a 16x2 LCD.

    Brandon C.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    No purchase necessary. See back panel for more details.

    Tired of the same old robot brains? not enough processing power? Get the Propeller Robot Module now!!

  • Bobb FwedBobb Fwed Posts: 1,119
    edited 2009-09-12 03:42
    Sorry, I wasn't familiar with the ADC object. I have taken a look at it, it appears you pass it an address of the variable you wish it to update, then just read the variable.

    Example:
      ADC.SigmaDelta(@adcvalue)    'start cog with sigma-delta ADC
      REPEAT
        DEBUG.dec(adcvalue)
        DEBUG.tx($D)
        waitcnt(clkfreq / 10 + cnt)
    
    


    Something like that. Let us know. I have no way to test it where I am.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    April, 2008: when I discovered the answers to all my micro-computational-botherations!
  • Brandon C.Brandon C. Posts: 106
    edited 2009-09-12 03:56
    That does work! Thank you very much! smile.gif
    But the value won't go below 32,000. is that normal? or is it the circuit?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    No purchase necessary. See back panel for more details.

    Tired of the same old robot brains? not enough processing power? Get the Propeller Robot Module now!!

  • Bobb FwedBobb Fwed Posts: 1,119
    edited 2009-09-12 04:09
    As stated previously I am unable to test, and am unfamiliar with this object (as a matter of fact, I am unfamiliar with the whole sigma-delta method).
    Won't go below 32000 (exactly) or 32767/32768?. Try wiring the input directly to ground or directly to 3.3V.

    Someone who is familiar with all this stuff should chime in eventually.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    April, 2008: when I discovered the answers to all my micro-computational-botherations!
  • Brandon C.Brandon C. Posts: 106
    edited 2009-09-12 04:12
    Bobb Fwed said...
    As stated previously I am unable to test, and am unfamiliar with this object (as a matter of fact, I am unfamiliar with the whole sigma-delta method).
    Won't go below 32000 (exactly) or 32767/32768?. Try wiring the input directly to ground or directly to 3.3V.

    Someone who is familiar with all this stuff should chime in eventually.

    Yeah, sorry. I meant 32767.

    Brandon C.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    No purchase necessary. See back panel for more details.

    Tired of the same old robot brains? not enough processing power? Get the Propeller Robot Module now!!

  • Bobb FwedBobb Fwed Posts: 1,119
    edited 2009-09-12 04:20
    Brandon C. said...
    Yeah, sorry. I meant 32767.
    The reason I ask is to see if it is a circuitry limitation or something in the software (seeing as 32767 is half of 16-bits -- i.e. 15-bits full of 1s). Why it is doing that I have no idea.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    April, 2008: when I discovered the answers to all my micro-computational-botherations!
Sign In or Register to comment.