Shop OBEX P1 Docs P2 Docs Learn Events
A to D communicating issues "ADC081S101" — Parallax Forums

A to D communicating issues "ADC081S101"

BitsBits Posts: 414
edited 2012-09-18 10:37 in Propeller 1
Please point out the mistake. I am using the ADC081S101. Here is my simple code. No data is gathered.
PUB ADC081S101 
                    
  outa[ADC_CS]:= 0
                    
  REPEAT  3
      outa[ADC_Clk] := 1 
      outa[ADC_Clk] := 0
      
  REPEAT  8
      outa[ADC_Clk] := 1 
      outa[ADC_Clk] := 0                                                                         
      result := (result << 1) + ina[ADC_Data]
      
  REPEAT  4
      outa[ADC_Clk] := 1 
      outa[ADC_Clk] := 0
                    
  outa[ADC_CS] := 1

Comments

  • AribaAriba Posts: 2,690
    edited 2012-09-18 10:37
    I think you need to read the data when the clock is high. Try it with this code:
    PUB ADC081S101 
                        
      outa[ADC_Clk] := 1 
      outa[ADC_CS]:= 0
                        
      REPEAT  16
          outa[ADC_Clk] := 0 
          outa[ADC_Clk] := 1
          result := result << 1 + ina[ADC_Data]
      outa[ADC_CS] := 1
      result >>= 5
    

    Andy
Sign In or Register to comment.