Shop OBEX P1 Docs P2 Docs Learn Events
AD7730 to BS2 interface problem — Parallax Forums

AD7730 to BS2 interface problem

ArchiverArchiver Posts: 46,084
edited 2001-01-08 18:56 in General Discussion
Hello,
This the first time I write a code for interfacing AD7730 to BS2 and I have
a problem.
With power-up or reset the BS2,there is no result ( 0 reading or fixed
random number ),I have to reset the AD7730 to get data.On power-up,the
AD7730 performs internal reset and all registers have default values. Later
on I should add calibration routine which should be performed only after
power-up.
What could be the problem?Any help would be appreciated.

Thank You
Mohamed refky

AD7730 is A/D for weigh scales.
Chip select CS hardwired low.

'code:AD7730.BS2
ADdata var word 'Variable to hold 16 bit AD.
DATAin con 2 'Data input.
DATAout con 3 'Data output.
SCLK con 4 'Clock to AD.
RDY con 5 'RDY input pin.

input 5 'Make P5 an input

start
shiftout DATAin,SCLK,msbfirst,[noparse][[/noparse]$02]'Write to Communication
'Register setting next 'operation as
write to Mode
'Register.

shiftout DATAin,SCLK,msbfirst,[noparse][[/noparse]$3080\16]'Write to Mode Register
'starting continuous
'conversion.

shiftout DATAin,SCLK,msbfirst,[noparse][[/noparse]$21]'Write to Communication
'Register setting next
'operation as continuous read
'from Data Register.

low 2 'Set DIN line low to insure part is not reset
'while in continuous read mode.
readData
waitRDY:
if RDY = 1 then waitRDY 'Wait for RDY to go low to indicate o/p
'update.
shiftin DATAout,SCLK,msbpost,[noparse][[/noparse]ADdata\16]'Read conversion result
'from AD7730's Data
'Register.

shiftout DATAin,SCLK,msbfirst,[noparse][[/noparse]$30] 'Ends continuous read
'operation.

debug DEC ADdata,cr 'Display data.
pause 1000 'Wait a second between readings.

goto start


_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
Sign In or Register to comment.