Shop OBEX P1 Docs P2 Docs Learn Events
SPI interface with ADS1256 ADC — Parallax Forums

SPI interface with ADS1256 ADC

bookworm1706bookworm1706 Posts: 14
edited 2011-07-12 11:08 in BASIC Stamp
Hello I am having problems interfacing with a ADS1256 24 bit ADC using the SPI interface with a BS2. I am fairly new to the microcontroller world having taken one class way back in college on it. However, first as I have read elsewhere it seems timing is critical. Thus since the spec sheet states there is a 50 * (period of reference clock) delay between the end of the serial clock pulse going in to the ADC and the beginning of the serial clock pulse going out of the ADC, I have using EME systems timing sheets value of about 520us between end of shiftout command and beginning of shiftin command set the reference clock for the ADC to 96.15 kHz. Does this seem right?

Then I tried to talk to the ADC, however, it does not want to talk back. All I am trying to do is read it's status register. I am just getting a 0. If anyone has any experiance with these ADC's please point me in the right direction. I will post the code and a link to the datasheet for the ADC below:

http://focus.ti.com/lit/ds/symlink/ads1256.pdf

' {$STAMP BS2}
' {$PBASIC 2.5}

'

'Program Name
'Author
'Date
'Program Description

'
I/O Defintions

'
Constants
CS PIN 0 'Chip Select
DRDY PIN 1 'Signals that chip is ready to output (active low) (Data Ready Output)
INPUT DRDY 'Set Pin 0 to input only
CLK PIN 2 'Clock to ADC, out on rising in on falling edge
DATAIO PIN 3 'Data I/O pin number/

'Command List
'RREG CON $1 'Read from REG rrr see p. 34
datatest CON $01
'
Variables
ADResulttst VAR Byte 'Variable to hold result of register read

'
Initializations
LOW CS 'activate ADC to begin
PAUSE 10

'
Main
MAIN:
GOSUB RDWR 'Go to Read Write ADC routine
DEBUG "Result:" , BIN ADResulttst, CR 'Display data which should show status
END
'
Subroutines
'
RDWR
RDWR:
SHIFTOUT DATAIO, CLK, MSBFIRST, [$10\8,$00\8] 'Send read register command and read only reg 0 (status register)
SHIFTIN DATAIO, CLK, MSBPOST, [ADResulttst\8] 'Get data bits which should show status register

RETURN 'Return to program

'
End of Program

Comments

  • bookworm1706bookworm1706 Posts: 14
    edited 2011-07-12 11:08
    Looking at this more I do not even think it is possible to interface this ADC with the BS2 as the minimum reference clock rate is 100kHz, The fastest I can clock the ADC and still possibly use the shiftin shiftout commands is 96.15 kHz according to the numbers given by emesystems. Therefore for a general question are BS2 stamps in general only able to communicate with Linear Technology products? For I have only been able to find ADC examples using LT chips or similar versions by other companies. The way the shiftin shiftout works seems rather set in stone to be able to communicate with this Ti chip. For even if the BS2 were fast enough the time differences between the two commands seems to make it unable to really synchronize them well with this particular Ti chip, again I do not have much experience. That being said if anyone can recommend a 24 bit or at least a 16 bit ADC that is guaranteed to work with the BS2 I would love to hear about it.
Sign In or Register to comment.