PDA

View Full Version : using AD7730 with Basic StampII



Agoua
01-18-2006, 04:22 PM
How to read the conversion data from AD7730

Mohamed Refky
01-19-2006, 01:26 AM
Hello,
I'm using AD7730 in weigh scale applications,here is example codes of writing and reading of registers:

ADdata var word 'variable to hold 16 bit result.
DATAin con 2 'AD data input pin.
DATAout con 3 'AD data output pin.
SCKL con 4 'clock to AD.
RDY con 5 'RDY input .

input 5

Initial:

SHIFTOUT DATAin,SCLK,MSBFIRST,[$FFFF\16,$FFFF\16] 'write 32 ones will reset the AD7730 to the default state.

SHIFTOUT DATAin,SCLK,MSBFIRST,[$02] 'write to communication register setting next operation as write to mode register.

SHIFTOUT DATAin,SCLK,MSBFIRST,[$3080\16] 'write to mode register starting continuous conversion for 10mV input range,unipolar,16 bit data word and 5V reference.

SHIFTOUT DATAin,SCLK,MSBFIRST,[$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 reade mode.

ReadData:

waitRDY:
IF RDY = 1 THEN waitRDY 'wait for RDY to go low to indicate output update.

SHIFTIN DATAout,SCLK,MSBPOST,[ADdata\16] 'read conversion result from data register.

DEBUG DEC ADdata,cr 'display data in decimal.

pause 500 'wait 0.5 second between reading.

GOTO ReadData


Regards
Mohamed Refky