Shop OBEX P1 Docs P2 Docs Learn Events
AD7705 analog-to-digital woes — Parallax Forums

AD7705 analog-to-digital woes

kolyurkolyur Posts: 43
edited 2011-10-30 19:05 in Propeller 1
Has anyone successfully interfaced the Prop to an Analog Devices AD7705 chip using the AD7705.spin object from the Obex?

My system will ultimately include a load cell to channel 1 (0-30mV) and a linear pot to channel 2 (0-2.5V, also the reference voltage). Just focusing on the pot for now, I am observing the following behavior:
1. With the pot connected to channel 1, and channel 2 disabled, I get a good reading.
2. With the pot connected to channel 2, and channel 1 disabled, I get a good reading.
3. With both channels enabled, and the pot connected to either channel (other channel connected to the load cell or left unconnected), I get zero readings on both channels. :frown:

At startup I am configuring the used channel(s) for unipolar buffered operation with an internal self calibration (gain of 1 for now). I'm displaying the readings on an LCD and I believe that communications between all devices are working properly. What it boils down to is that I don't understand why the channels seem to affect each other. Shouldn't they be completely independent? I have not seen anything in the datasheet that would indicate what could cause this.

Thanks for any suggestions.

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2011-10-29 14:40
    As with any question of this sort, you need to provide the source of your program for cases #1-3 and details of how the AD7705 is connected and powered in each case. The channels should not affect each other.
  • kolyurkolyur Posts: 43
    edited 2011-10-29 16:36
    Here is my test code:
    [SIZE=2][FONT=lucida console]con
      _clkmode = xtal1 + pll16x
      _xinfreq = 5_000_000
      MS_001   = 80_000_000 / 1_000
    
    obj
      lcd[2]  : "LCD_16x2_4bit_jdc"
      adc     : "AD7705_jdc"
         
    var
      long LCD0stack[64]
      long potval
      long loadval
      
    pub main
      waitcnt((500 * MS_001) + cnt)               
      outa[15] := 0
      dira[15] := 1 
    
      cognew(runLCD0, @LCD0stack)
    
      adc.init(16,18,17,19)
      adc.ConfigureChannel2(00_1100,00_0110)          'pot
      adc.ConfigureChannel1(00_1100,00_0110)          'load cell
      
      repeat
        waitcnt((200 * MS_001) + cnt)
        potval := adc.GetChannel2
        loadval := adc.GetChannel1 
    
    pub runLCD0
      waitcnt((1000 * MS_001) + cnt)
      lcd[0].start(8,9,10,11,14)
      lcd[0].clear
       
      repeat
        waitcnt((250 * MS_001) + cnt)
        lcd[0].clear
        lcd[0].move(1,2)
        lcd[0].dec(potval)
    
        lcd[0].move(1,1)
        lcd[0].dec(loadval) 
    [/FONT][/SIZE]
    

    In its current state (configuring and reading both channels) it doesn't work--returns zero for both channels. If I comment out the ConfigureChannel and GetChannel methods for one channel, the other channel works.

    Here's my schematic showing the AD7705 and connections to the Propeller. J3 is to the load cell and J4 is to the pot (pin 2 is wiper). During my testing I haven't been using the load cell, just moving the pot back and forth between AIN1 and AIN2.

    ad7705.jpg
    800 x 579 - 85K
  • kolyurkolyur Posts: 43
    edited 2011-10-29 16:43
    Hmm the editor is trying to parse my code or something... the binary numbers aren't showing up right. Here's a screenshot:
    adccode.jpg
    543 x 737 - 134K
  • kolyurkolyur Posts: 43
    edited 2011-10-30 19:05
    I believe I had a basic misunderstanding about the operation of this device. I assumed that both channels could be set up completely independently (unique gains, buffering, etc). My testing seems to indicate that this is not the case. The load cell requires a gain of 64 and no buffering. The pot requires a gain of 1 with buffering. I can make them work independently but not together. Even though the setup register for each channel has a setting for gain and buffering, I believe these settings are universal to both channels. The datasheet doesn't seem very clear on the subject.

    So, I will either need to use two AD7705's or continually switch back and forth between channels. Just an FYI for others who may be considering this chip.
Sign In or Register to comment.