Spin code for Acitivity Board ADC

I looked in the OBEX, but could not find anything for the ADC chip that is on the Activity Board. I believe all the support code for the Activity Board is PropCCC. The ADC that is on the Propeller BOE, is a different one than what is on the Activity Board. Same holds true for the C3 board.

I am doing some testing of the fastspin(BASIC) program, and I am using the WX Activity Board as the test unit. Now that I think about it, I will probably need the Spin version for the WiFi part also, if anybody has some leads.

Thanks

Ray

Comments

  • 10 Comments sorted by Date Added Votes
  • Do you know what ADC chip is used on the Activity Board? I couldn't find a part number on the schematic nor mentioned in the Board Guide document. I could throw together a driver in Spin in a couple of days if I had a datasheet for the part.
  • Looks like: Texas Instruments ADC124S0214 (ADC124S021CIMMX/NOPB)
    Datasheet: ti.com/lit/ds/symlink/adc124s021.pdf
    Livermore, CA (50 miles SE of San Francisco)
  • Here's a spin (PASM, actually) driver for that ADC chip that I picked up at some point in time (not sure where this came from)...

    dgately
    Livermore, CA (50 miles SE of San Francisco)
  • Here's a simple test program that reads in a value from each channel and displays it via a serial port. Everything is contained in a small Spin routine (ReadADC) plus a couple of initialization lines in the main method (subroutine) and a few pin definitions.
  • If you are looking for a start to using SPIN on the WX module, I put up some programs on Obex 881.
  • dgatelydgately Posts: 976
    edited October 23 Vote Up0Vote Down
    Mike Green wrote: »
    Here's a simple test program that reads in a value from each channel and displays it via a serial port. Everything is contained in a small Spin routine (ReadADC) plus a couple of initialization lines in the main method (subroutine) and a few pin definitions.

    EDIT: Did not see that your code may actually be using an SPI read... But, still not able to get correct results, so far.


    Doesn't the ADC124S0214 require an SPI based interface and not I2C? Or am I missing something (tried your code and it just spits out random-ish data...

    ScreenShot.jpg
    These numbers just spin different negative numbers for 3 inputs, running 3.3 volts through differing resistors to the ADC inputs A/D 0-2. (Note: A/D 3 had no input in this case...)

    dgately
    1556 x 937 - 98K
    Livermore, CA (50 miles SE of San Francisco)
  • This is my Spin code for that ADC.
    Jon McPhalen
    Hollywood, CA
    It's Jon or JonnyMac -- please do not call me Jonny.
  • Thanks JonnyMac. You go through two 16-bit read cycles to get a correct read on the second cycle. I forgot and just did a single read cycle. Rsadeika and dgately, use JonnyMac's code.
  • I must have a blown ADC chip. I still get unexpected results... The only result that works is if I send a GND signal to one of the ADC channels. Then, I get a 0 response. Sending a 3.3 volt signal gives me flakey values that bounce around 2749 to 2751, decimal (not the expected 4095)...

    I'll try another AB board.
    Livermore, CA (50 miles SE of San Francisco)
  • twm47099twm47099 Posts: 664
    edited October 23 Vote Up0Vote Down
    4095 will give you 5 volts. 2750 gives 3.38

    v = 2750*5/4095

    v = adc_val * 5/4095

    Hope this helps.
    Tom
Sign In or Register to comment.