PDA

View Full Version : Need help with Load cell



azrael
11-19-2006, 12:47 AM
I am building a·scale using a load cell (LCL-040) from Omega, AD7730, and a basic stamp 2:
I have made the necessary connections, and i have no changes in the output on the debug screen, there is output in the load cell as i used a
voltmeter to check on it. I have tried to fix the problem but have reached a dead end, could there besomething missing in my connections?·I also made some chages in the code, renumbering the con pins. ·Please help me.

Aaron

Here is some of the information i have received by this forum (Mostly from Mohammed Refky):

AD7730 connctions BS2

(SCLK) pin1--------pin12 (P7)
(DIN) pin22--------pin13 (P8)
(DOUT) pin21------pin14 (P9)
(RDY) pin20 -------pin15 (P10)

To calculate the weight for 5kg load cell with 2mV/V o/p:

Input range = 10
16 bit mode
5V excitation voltage

weight = code**5000 'weight in grams

For full-scale calibration use your software to correct the value.

For Connecting the Load Cell to AD7730:
LCL is a four wire load cell

For single supply operation (unipolar)

Load Cell······················· AD7730

RED=+EXC····················· +5V
BLACK=-EXC···················AGND
GREEN=+SIGNAL············· AIN1 (+)
WHITE=-SIGNAL············· AIN1 (-)
···································REF IN (+) ---->+5V
·································· REF IN (-) ----> AGND

Program code:
'{$STAMP BS2}
'{$PBASIC 2.5}
'The AD7730 accepts LOW volt from load cell AND outputs serial digital Word.
'BS2 code reads the 16 Bit Word AND converts it TO weight so program should be set to
'a setpoint at certain weight NOT resistance of the load cell.
'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
END

Merf
03-24-2008, 01:13 PM
Did you ever figure out your problem?· I am getting the same result and its very frustrating.· Thanks· Merf

MSDTech
03-24-2008, 07:17 PM
I think your problem might be in the line:
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.
You want the chip in bipolar mode rather than unipolar mode. I'm not familiar with the AD7730 chip, but it look similar the the AD7705. With the chip in unipolar mode you may not see a negative voltage out of your load cell.· It's possible, depending on the starting conditions for the cell, for the output to be negative.
I'm using and AD7705 with a 30 mv load cell and getting very good results and can send you the code, but cannot be sure if all the setup parameters would be compatable.

Post Edited (MSDTech) : 3/24/2008 12:04:12 PM GMT

Merf
03-24-2008, 11:24 PM
MSDTech:· I think from reading the manufacturer's publication for the AD7730 that if you use a 5Vdc excitation voltage compared to ground, you are working in unipolar mode (i.e. +5Vdc and ground connected to AIN1+ and AN1- respectively).· This is·what I am trying to do.· It appeared to me (trying to decipher the manufacturer's materials is not easy reading·http://forums.parallax.com/images/smilies/confused.gif·) that bipolar is when you try to excite with 10Vdc (using +5V and -5V on the AN1+ and AN1- connections).· I may be wrong, and I'd love to solve the problem so any suggestions you may have are greatly appreciated.



·· ·I·have used Mohamed's·code and connected the unit using all of the connections suggested and still get a string of "0" [zeros] in the debug terminal.· Very frustrating.· Perhaps Mohamed Refky has a suggestion.· Any input on this one would be appreciated.· Merf

MSDTech
03-25-2008, 04:26 AM
Actually the Bipolary/Unipolar bit sets if the AD7730 will measure negative voltages. This is the description of the bit from the AD7730 datasheet.
Bipolar/Unipolar Bit. A 0 in this bit selects bipolar operation and the output coding is 00 . . . 000 for negative full-scale input, 10 . . . 000 for zero input, and 11 . . . 111 for positive full-scale input. A 1 in this bit selects unipolar operation and the output coding is 00 . . . 000 for zero input and 11 . . . 111 for positive full-scale input.
Positive input of the differential, programmable-gain primary analog input pair. The differential analog input ranges are 0 mV to +10 mV, 0 mV to +20· V, 0 mV to +40 mV and 0 mV to +80 mV in unipolar mode, and ±10 mV, ±20 mV, ±40 mV and ±80 mV in bipolar mode.
I would suggest changing the parameter from $3080 to $2080 just to see if you still get all zeros. Its very possible the polarity on the cell output is backwards. In the unipolar mode, that would give you all zeros. The bipolar will show a value even if the load cell polarity is reversed. I had a struggle with the load cell on my scale until I realized that it output negative then shifted through 0 to a positive (based on the wire color codes) as the load was increased.
One other factor. The AD7730 is a 24bit converter that sends MSB First. Based on the code above, you are only reading the first 16 bits of the 24, so you may be getting an output but aren't reading it.

Post Edited (MSDTech) : 3/24/2008 9:46:11 PM GMT

Merf
03-25-2008, 06:08 AM
MSDTech:· Thanks for your ideas.· I will try to implement them tonight.· I must admit that you lost me in your discussion of the coding required to select bi and uni-polar operation.· I'm not an engineer, so could you please explain briefly how you generate the code that you provide ($3080 and $2080)·from the 00, 10, and 11 discussion?··This is I'm sure a very stupid question and I appreciate your patience.· Is it simply hex versus binary?··I have found that the AD7730 is·not very user friendly (except I guess for experts).·

· Did you need to use capacitors in conjunction with the crystal?·

· I occurs to me that my load cell is designed for 10 vDC excitation (the manufacturer indicates that 5 v excitation will work, but the resolution will be better with the highter excitation·voltage).· This load cell generates 3mV/V.· Were you able to decipher from the spec sheet whether someone could excite with 10VDC?·· If so, do you have a suggestion on how I might hook it up and write the code?···Would I need a separate power supply with + and - 5 VDC?

· Finally, what is the purpose of the "\16" in all of the code examples?



Thank you very much for your time and input.· Merf

MSDTech
03-25-2008, 06:32 AM
The $2080 and $3080 are hex for the binary %0010000010000000 and %0011000010000000 respectively. I usually use Calculator under windows to generate these codes. You enter the bits that you need to set in the registers with Calculator in scientific mode and the BIN radio button selected. Then select the HEX radio button to the the hex representation.

You normally don't need to use capacitors with the crystals, but you do need to check the capacitance of the crystal with the value listed in the datasheet to make sure its compatible.

You might want to consider using the AD7705 rather than the AD7730. They are both by the same manufacturer, but for the basic stamp the AD7705 has a 16 bit data output. The AD7730 has a 24 bit data output, which is much harder to deal with using the 16 bit Basic Stamp family of processors. The way the code you've listed works, you will only be reading the 16 highest bytes of the result. I suspect under low load conditions that the reading is in the 8 bits you are not reading.

As far as the exitation voltage, if you can get the resolution you need for your application, then go for it with 5V. These load cells are just a wheatstone bridge and should work with any voltage that does not generate too much power in the 4 resistance elements.

It might help if you describe the application you are trying to build. IE what type of load and what is the maximum load for the load cell? The application I'm putting the final touches and debugging on is a weather station. The load cell is used to weigh the collected rainwater to determine the amount of rainfall (or water equivalent in snow). I had a hard time finding an acceptable load cell at a reasonable price. I finally found a cheap electronic scale at Wal-Mart with an adequate capacity/sensitivity·and stripped it. Inside was a cantiliever beam with a load cell. I threw away the original electronics to build my own that I could read with at BS2.

Post Edited (MSDTech) : 3/24/2008 10:43:05 PM GMT

tabbott
03-25-2008, 06:40 AM
A load cell's specs, when given in mV/V, mean that for every volt of excitation voltage, you will see that many mV out when the load cell is fully loaded. So for your 3mV/V cell loaded at 5kg the voltage out will be: 30mV for 10V and 15mV for 5V.

The \16 tells the program to read (or write) 16 bits of data. As the converter is a 24 device, that will mean you will drop the 8 lower bits of your output, effectivly giving you only a 16 bit resolution.
Unfortunatly, the stamps max variable size is 16 bits. If you find you really need all of the 24 bits of resolution (the max I have ever needed was 12 bits, but that is off the point) use two variables in the same statement: SHIFTIN DATAout,SCLK,MSBPOST,[ADdata\16, ADdata2\8] This will tell the stamp to place the first 16 bits in the first variable and the remaining 8 bits of data into the second.

A value higher than \16 can be used. Lets say you have a word variable and use a \24 modifier - 24 bits will be read, but the UPPER 8 bits will be dropped due to overflow. I use this a lot when an ADC requires more clock cycles than data bits.

Merf
03-25-2008, 07:05 AM
Thanks for the ideas.· My project is to weigh a racing sailboat (Thistle class·which is 17.5·feet).· The boats weigh anywhere from about 515 to 530 pounds· (the idea is to have your boat as close to minimum weight (515) as possible).· I have an electric chain hoist, so you put the load cell between the hook and the slings to weigh the boat.

··The load cell I purchased is from Load Cell Central: model XTS4-1K (the "1k) means the one I bought has a capacity of 1000 pounds.· Here is a link to show you the unit and the specification sheet:·http://www.800loadcel.com/load_cells/stype_load_cell.html

· My idea was to receive the information from the AD7730 and process it with a BS2e and then convert the data in some manner so as to output the result in 1 pound increments to a 3 digit 7 segment LED display.· I want to use a MAX 7219 LED display driver--since I have used that unit to build a thermometer in the past.··So I would anticipate that I'll need the stamp to do some math and probably need to convert the information from the AD7730·in some form so that the MAX 7219 can understand it and display the weight.

···I'm not sure how one is to calibrate the scale, and so that will also be a task for this project.· I also wanted the ability to get a "tare" reading so that the lifting tackle (slings and line) can be zeroed out before weighing the boat.

· I am not an engineer but I can typically build circuits from schematics.· I have had some success using the MAX 7219 in the past, but I hope that this project isn't too over my head.

· Your ideas are appreciated and very helpful.· Thank you.· Merf

Mohamed Refky
03-30-2008, 02:58 AM
The initial code for AD7730 is not complete,it is just example for reading and writing of different registers.

Exact AD7730 Code FOR BS2

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, [$03]'write to communication register setting next operation as write to Filter Register.

SHIFTOUT DATAin, SCLK, MSBFIRST, [$7040,$10]'output rate for 50Hz line frequency in CHOP mode and DC excitation

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

SHIFTOUT DATAin, SCLK, MSBFIRST, [$B0B0\16]'write to mode register initiating internal full scale calibration

pause 500

SHIFTOUT DATAin, SCLK, MSBFIRST, [$02]

SHIFTOUT DATAin, SCLK, MSBFIRST, [$D080\16]'write to mode register initiating system zero scale calibration

pause 500

SHIFTOUT DATAin, SCLK, MSBFIRST, [$02]

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 read 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

********************************

You may write the initial code like this:

SHIFTOUT DATAin, SCLK, MSBFIRST, [$FFFF\16,$FFFF\16]

SHIFTOUT DATAin, SCLK, MSBFIRST, [$03,$7040\$10]

SHIFTOUT DATAin, SCLK, MSBFIRST, [$02,$B0B0\16]

pause 500

SHIFTOUT DATAin, SCLK, MSBFIRST, [$02,$D080\16]

pause 500

SHIFTOUT DATAin, SCLK, MSBFIRST, [$02,$3080\16]

SHIFTOUT DATAin, SCLK, MSBFIRST, [$21]

LOW 2

********************************

The step of initiating system zero scale calibration remove tha pan weight and the display will show zero reading.This is performed after power up.

The AD7730 has a 24 bit or 16 bit data output,so :

Code = (Ain/Input Range)*2^n
Ain is the the analog input voltage and n = 16 in 16 bit mode and n = 24 in 16 bit mode of operation.
I use 10 mV input range for 2mV/V load cell
Weight = {Ain/[load cell sensitivty (mV/V) x excitation voltage]}*load cell capacity (kg)
Substitute Ain from code equation
The result is not exact value because neither the supply is exact 5V nor the load cell is exact 2mV/V.
So I use software to correct the weigh reading according to a knwon weight.

dre
03-30-2008, 04:01 AM
Re: Use of a loadcell to weigh your sailboat.

The best calibration is to physically apply weight to the loadcell. In the case of wanting to accurately weigh 500 to 600 lbs you can simply weigh several bags of, say, sand on an accurate scale, noting the exact weight of each bag and rig enough of them to be weighed with the loadcell. In the case of calibrating homebuilt loadcells [gaged sailboat stay turnbuckles] I have used the weight of the rear of a vehicle [a pickup] as hoisted [with the turnbuckle as part of the hoist] so as to raise the rear wheels off the ground. Of course you have to hoist using a secure attachment - a bumper won't do. And you have to have had the vehicle weighed, both front and rear, in order to calculate the CG, the vehicle weight and the moment arms about the front wheels.

A more accurate way to calibrate is to have the loadcell output measured along with that of a standard cell in a loading frame; which is rather expensive. Is the loadcell manufacturer's stated output to be believed? Strain gage based loadcells are generally quite linear; so any known weight check might be sufficient. How about having your Thistle weighed at a certified site and using this as a base weight? If the loadcell output returns to zero upon weigh removal, it is probably dependable.

In any regard it is best to note an equivalent 'simulated' output using a 'shunt' resistor across one arm of the loadcell's wheatstone bridge. This simulated output can then be used later to electronically recalibrate the instrumentation. This shunt calibration procedure is written up in tutorials on strain gage based loadcells.

Regarding tare weight: This can be nulled out using a 10-turn pot balancing circuit wired across two adjacent arms of the wheatstone bridge. Nowadays it is probable best to let the Stamp program subtract the tare weight.

I prefer to use an instrumentation amplifier [INA 125] with built-in bridge excitation, and a A/D converter [TLC2543] with it's extensive, Stamp related, documentation, thanks to Dr. Allen. This arrangement allows me to read the amplified loadcell analog output as a check.

Success with the Thistle weighing.

Sailboats aren't just for sailing anymore. ;o)

Mohamed Refky
03-31-2008, 04:16 AM
Here is the code to check that·communication between BS2 and AD7730 is right.

'This program reads tho power-on /reset default values of AD7730.

DATAin···· con 2··········· ·'AD data input pin.

DATAout·· con 3··········· 'AD data output pin.

SCKL········con 4··········· 'clock to AD.

X0··· var···· word

X1··· var···· word

SHIFTOUT DATAin, SCLK, MSBFIRST, [$FFFF\16,$FFFF\16]

SHIFTOUT DATAin, SCLK, MSBFIRST, [$10]

SHIFTIN DATAout, SCLK, MSBPOST, [X1]

DEBUG "STATUS REGISTER "," ",ihex2 X1,cr·····················'Value is $CB.



SHIFTOUT DATAin, SCLK, MSBFIRST, [$12]

SHIFTIN DATAout, SCLK, MSBPOST, [X1,X0]

DEBUG "MODE REGISTER "," ",ihex2 X1,hex2 X0,cr·············'Value is $01B0.



SHIFTOUT DATAin, SCLK, MSBFIRST, [$13]

SHIFTIN DATAout, SCLK, MSBPOST, [X1,X0\16]

DEBUG "FILTER REGISTER "," ",ihex2 X1,hex4 X0,cr·············'Value is $200010.



SHIFTOUT DATAin, SCLK, MSBFIRST, [$14]

SHIFTIN DATAout, SCLK, MSBPOST, [X1]

DEBUG "DAC REGISTER "," ",ihex2 X1,cr························· ···'Value is $20.



SHIFTOUT DATAin, SCLK, MSBFIRST, [$15]

SHIFTIN DATAout, SCLK, MSBPOST, [X1,X0\16]

DEBUG "OFFSET REGISTER "," ",ihex2 X1,hex4 X0,cr·············'Value is $800000.



SHIFTOUT DATAin, SCLK, MSBFIRST, [$16]

SHIFTIN DATAout, SCLK, MSBPOST, [X1,X0\16]

DEBUG "GAIN REGISTER "," ",ihex2 X1,hex4 X0,cr··················'Value is $593CEA.

END

Merf
04-14-2008, 08:49 AM
Mohamed:· I tried your program to check the connection with the AD7730 and all of the values came out on the debug screen exactly as anticipated.http://forums.parallax.com/images/smilies/cool.gif

··So it appears the AD7730 is communicating with the BS2e correctly.· Still, when I connect the load cell with the regular program you wrote, I·only get a string of 0s (zeros) in the debug screen.· Is it possible the AD7730 is not amplifying the signal from the load cell enough to register?· The load cell is designed for 10 VDC excitation,·but it works with less·voltage too (see comment below).··This has become quite frustrating. http://forums.parallax.com/images/smilies/confused.gif··

I am also concerned that perhaps I am missing some resolution because of·bits being lost in the transfer (16 vs. 24).· I know the load cell is working because my DVM easily can sense millivolt fluctuations in voltage output with the load cell exited with the minimal 5 volts for·testing (I literally pulled·on either side of the load cell with my arms and this showed varying milivolt outputs from·the load cell·relative to·my physical straininghttp://forums.parallax.com/images/smilies/freaked.gif···

· I normally don't encounter such a total failure on a project.· This is indeed a major bummer.· Your ideas are very much appreciated.· Merf

stuerm
12-23-2009, 05:30 PM
Hi MSDTech or whoever can help,

On 24/03/2008 you wrote you would work with an AD7705 and could send the code you used. Is this offer still open? Because I am trying the same CHALLANGE no allready for too long time and somehow I can not reach the goal!

I use the following code and most time the Drdy pin stays a logic one and if not it communicates some random nonsense! Can you see an obvious mistake in the code or give any other hints?

Cheers stuerm

Pin connection:

1: Clock -> pin 0 of B2
2&3: 4.9152MHz crystal
4:CS ->GND
5:Reset -> 1k Vdd
6:Ain2+ -
7:Ain1+->potentiometer 0-4V
8:Ain1-->GND
9:Ref+->1k Vdd
10:Ref-->GND
11:Ain2--
12:Drdy->pin1 of B2
13: Dout-> pin2 of B2
14: Din-> pin3 of B2
15: Vdd = 5V
16:GND

' {$PBASIC 2.5}
'Communication with the analog digital converter AD7705

SCLK CON 0 'clock to AD.
READY CON 1 'AD ready pin number, if low, new output can be read
DATAout CON 2 'AD data input pin number
DATAin CON 3 'AD data output pin number
PINReady PIN 1 'AD ready pin

weight VAR Word
weightOld VAR Word

'write to communication register
SHIFTOUT DATAin, SCLK, MSBFIRST, [$20]'20 '0010|0000:ready (0), select clock register (010),write (0), not stand by (0),Channel AIN1 (00)
'write to the clock register
SHIFTOUT DATAin, SCLK, MSBFIRST, [$0c]'$0c '0000|1100:(0000),cristal freq devided by 2 (1),clock freq 4.9152MHz (1),outputrate 50Hz (00)
'write to communication register
SHIFTOUT DATAin, SCLK, MSBFIRST, [$10]'10 '0001|0000:ready (0), select setup register (001),write (0), not stand by (0),Channel AIN1 (00)
'write to setup register for calibration
SHIFTOUT DATAin, SCLK, MSBFIRST, [$40]'40 0100|0000:Mode self calibration (01),gain=1 (000), unipolar (0), buffer off (0),Fsync on (0)
PAUSE 1000
DO
GOSUB WaitRDY
'write to the communication register
SHIFTOUT DATAin, SCLK, MSBFIRST, [$38]'38 '0011|1000:ready (0), select data register (011), read (1),not stand by (0),Channel AIN1 (00),
'read from data register
weightOld=weight
SHIFTIN DATAout, SCLK, MSBPRE, [weight\16] 'read conversion result from data register.
IF weight<>weightOld THEN
DEBUG SDEC ? weight, CR
PAUSE 500
ENDIF
LOOP
END

WaitRDY:
DO WHILE (PinREADY)
DEBUG IBIN8 ? PinReady,CR
PAUSE 100
LOOP
RETURN

RogerN
12-23-2009, 11:47 PM
If the resolution is good enough, you could use an instrumentation amplifier and an A/D converter like the LTC1298. The advantage is that the code for the LTC1298 is already available.

RogerN

stuerm
12-25-2009, 08:49 PM
Hi RogerN
Thanks for your fast answer. The ADC is used for a load cell with a voltage range of 0-5mV. I need a resolution of about 1 micro Volt. Do you think this works with LTC1298 coupled with an instrumentation amplifier? Which amplifier would you propose? Do I have to mind about noise that would result in a unsteady digital output?
Cheers stuerm

RogerN
12-26-2009, 11:36 AM
Digi-Key sells an INA122 instrumentation amp that only requires a single supply. From a quick look at the specs it looks like a 200 ohm gain resistor would give you a gain of about 1000, enough to give you a 1uV reading from 0 to 4.095 V, or not quite one uV resolution over the entire 0-5mV range.

I looked at the chip they are discussing here and the resolution up to 24 bit sounds awesome, hopefully someone will be able to get the Basic Stamp working with that chip, it certainly looks worth the effort. I mentioned the LTC1298 because it and an instrumentation amp would fit most of my needs as far as tinkering with scales and force sensing, but I plan to order the AD7730 chip on my next Digi-Key order. I bought some eBay load cells suitable for a gun powder reloading scale. I may experiment with an automatic powder measuring system.

RogerN

RogerN
01-02-2010, 03:02 AM
I bought one of these AD7730 chips, did anyone ever get their program working with this chip? My load cell is currently wired to an instrumentation amp but would like to try it out on the AD7730 chip this weekend as time allows.

RogerN

Mohamed Refky
01-03-2010, 06:56 PM
Here is exact code I use for 5 Kg load cell 2mV/V,5V AC excitation.


'AD7730
ADdata··· VAR· Word·· 'variable to hold 16 bit AD result.
SCLK····· CON· 9······ · 'clock to AD pin number.
DATAIN··· CON· 10···· ·'AD data input pin number.
DATAout·· CON· 11···· 'AD data output pin number.
RDY······ CON· 12······ ·'RDY input pin number.

wf··· DATA· Word $1388···· ·'store· weigh scale factor,5000.

INPUT 0····· 'make P0 an input

AD7730:

· SHIFTOUT DATAin,SCLK,MSBFIRST,[$FFFF\16,$FFFF\16]
· SHIFTOUT DATAin,SCLK,MSBFIRST,[$03,$7040\16,$30]· 'AC excitation,no
· delay.for·DC·change $30 to $10
· SHIFTOUT DATAin,SCLK,MSBFIRST,[$02,$B0B0\16]
· PAUSE 1000·· 'wait for internal full scale calibration.
· SHIFTOUT DATAin,SCLK,MSBFIRST,[$02,$D080\16]
· PAUSE 1000·· 'wait for system zero scale calibration.
· SHIFTOUT DATAin,SCLK,MSBFIRST,[$02,$3080\16]
· SHIFTOUT DATAin,SCLK,MSBFIRST,[$21]
· LOW 10

main:

··· IF IN0 = 0 THEN keypress······· ·· 'check for calibration key press.
··· IF timer >·50 THEN program········'0.5 sec between reading.
··· timer = timer + 1
··· GOTO main

program:

··· GOSUB getdata
··· GOSUB Maxdisplay··················· 'display data.
.
.
.
··· timer = 0
GOTO main

getdata:
waitRDY:
··· IF RDY = 1 THEN waitRDY
··· SHIFTIN DATAout,SCLK,MSBPOST,[ADdata\16]
··· dispVal = ADdata ** weighFactor···· 'weigh equation.
RETURN

******
Initiating zero scale calibration remove tha pan weight and the display will show zero reading.
This is performed after power up.
For full scale calibration·I put a known weight on the pan and on pressing a key, a routine is running to correct the "weighFactor" in weight equation until the the display reading match the known weight.