Shop OBEX P1 Docs P2 Docs Learn Events
Propeller Question... — Parallax Forums

Propeller Question...

xnederlandxxnederlandx Posts: 4
edited 2008-06-07 20:24 in Propeller 1
Hi,

I've read the manuals etc. it says something about Analog to Digital Conversion (CTRA/CTRB ?), but not in much detail smhair.gif


Can the propeller do Analog to Digital Conversion, and If so how many bit is it? confused.gif

Would you have any coding examples (for Spin)?

Thanks in advance. smile.gif

Post Edited (xnederlandx) : 6/7/2008 9:28:40 AM GMT

Comments

  • Graham StablerGraham Stabler Posts: 2,510
    edited 2008-06-06 10:32
    ADC can be done using a process called delta sigma conversion:

    en.wikipedia.org/wiki/Delta-sigma_modulation

    Chip shows an example here of both ADC and DAC.

    http://forums.parallax.com/showthread.php?p=576575

    Taken from my thread index which you may find helpful:

    http://forums.parallax.com/showthread.php?p=609066

    Graham
  • xnederlandxxnederlandx Posts: 4
    edited 2008-06-06 10:40
    Thankyou very much tongue.gif
  • xnederlandxxnederlandx Posts: 4
    edited 2008-06-07 06:21
    Hi

    Thanks again for that, I read your SPIN EXAMPLES for BEGINNERS GUIDE, its great smilewinkgrin.gif and has taught me a lot !

    I have a 12bit ADC In...

    I've been looking at Objects with floating point (?) calculation but they're all so complex to me...
    How can I find the square root of the 16bit ADC in (with decimal)?

    Sorry for asking so many questions... [noparse]:([/noparse] I'm new to the propeller and the SPIN language.

    Thanks again.

    Post Edited (xnederlandx) : 6/7/2008 8:20:41 AM GMT
  • Mike GreenMike Green Posts: 23,101
    edited 2008-06-07 15:18
    There is an integer square root operator. If you want the square root to 1 decimal place (as a scaled integer), you'd do:

    result := ^^( ADCvalue * 100)

    If you want the square root to 2 decimal places (as a scaled integer), you'd do:

    result := ^^( ADCvalue * 10000)

    Similarly, three decimal places would be:

    result := ^^( ADCvalue * 1000000)

    Note that this last case will only work for a 12 bit ADC value because of overflow of the 32 bit intermediate result
  • xnederlandxxnederlandx Posts: 4
    edited 2008-06-07 20:24
    Thanks again!
Sign In or Register to comment.