SPI interface with ADS1256 ADC
bookworm1706
Posts: 14
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
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