Shop OBEX P1 Docs P2 Docs Learn Events
Getting garbage from the National Semiconducter ADC088S052 8 channel ADC — Parallax Forums

Getting garbage from the National Semiconducter ADC088S052 8 channel ADC

BillDerBillDer Posts: 33
edited 2011-06-23 03:07 in Propeller 1
I am at a loss to explain why I get the same twelve bits on all 8 channels when I should be getting 0's or close to 0 on 7 of them and be getting something close to represent 1.5 Volts on chan. 0. I first tried to use the SPI code from Beau in the OBEX then found this driver fromCanniba lRobotics who posted the ADC088S052 Driver.
I did adjust the Clk, Din, Dout, CS pins accordingly.
Anyone with experience with this chip or with SPI code that overlaps the address out with the MSB of the data in? The timing chart for the ADC088S052 is attached.

Comments

  • JonnyMacJonnyMac Posts: 9,208
    edited 2011-06-21 06:13
    I don't have that chip but I have written code that overlaps sending and receiving bytes via SPI. Based on the docs for that chip, I'd give this a whirl:
    pub adc_read(setup) : adc
    
      setup := (setup & %111) << (32-5)                             ' shift to bit31
    
      outa[ADC_CS] :=  0                                            ' select
      
      repeat 16
        outa[ADC_DIN] := (setup <~ 1) | 1                           ' output setup bit   
        outa[ADC_CLK] := 0                                          ' clock a bit    
        outa[ADC_CLK] := 1
        adc := (adc << 1) | ina[ADC_DOUT]                           ' get bit from dout
    
      outa[ADC_CS] := 1                                             ' de-select
      
      adc := (adc >> 4) & $FF                                       ' cleanup
    

    You'll need to setup the IOs (see constants in code) prior to calling this the first time.
  • Kirk FraserKirk Fraser Posts: 364
    edited 2011-06-21 06:30
    BillDer, Do tell us if the above post solved your problem. If not, I can get my old code for input from a similar TI chip with 11 channels which worked on a BS2. Converting it to a Propeller program though I can't help with.
  • BillDerBillDer Posts: 33
    edited 2011-06-22 04:04
    Thanks for the code. I will try this out tonight after work.
  • BillDerBillDer Posts: 33
    edited 2011-06-23 03:07
    Thanks to everyone, I was able to talk to the chip last night. This forum is the best I can't believe how helpful everyone is.
    Thank you.
    Bill
Sign In or Register to comment.