This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

ads1230 interfacing 8052

Other Parts Discussed in Thread: ADS1230

Hi Bob,

I m facing two issues..

1)

 To interface ADS1230 with microcontroller, i m using the usual formula:

s_data =( ((h_data - n_data) - (TARE)) * cal_data ) / (adc_count - no_load) //were TARE = (h_data - n_data).

The above formula is working fine, for my weighing scales.But the problem i m facing is,when i m calibrating for higher weights..i.e. 300kg,500kg..The cal_data will be = 300000 for 300kg and 500000 for 500kg to enter into the microcontroller.

So during calibration time the adc internal counts is also increased from no_load to adc_count.

Consider my adc counts are increased from 10500(no_load)  to 55000(adc_count)// while placing weight on the loadcell.

So as from the formula

s_data = (((55000 - 10500) - TARE) * 500000) / (adc_count - no_load)..

So here during multiplication process the value will sometimes exceeds the memory space and shows the error values for higher capacities.Because i m using " long int datatype".

Due to this reason i used float datatype to divide and store the values,So my_data =  ( cal_data / (adc_count - no_load)) ,then

s_data =  ((n_data - h_data) * my_data)..so here i get the exact weight.

This procedure is working well. but the microcontroller takes more machine cycles for the operation and its a slower process..

So how to deal with the adc counts for higher value calibration without exceeding the memory space or without using float datatype.

2)

Consider my weigh scale in zero weight.After sometime the counts may drift slightly due to environmental changes , adc error or loadcell error.So after sometime the customer need to push the TARE button to balance the error.In my weigh scales there is no Auto tare option to provide zero stability.So what step should i take to provide Auto tare option,without pushing the TARE button for slight changes...?

Please help..I need your valuable suggestions to take further steps....

Thank You

by

Ajit.

  

  • Hi Ajith,

    For 1, the end result determines the size and format you will need to use.  Yes, floating point math takes longer and some micros have math engines built in to do the math more quickly.  Another possibility is to use some tricks in the code to make sure that the result never goes beyond 32 bits (really 31 as the output result is signed.) Let's say you use 50000 instead of 500000.  When you display the result you move the decimal place of the output one character position to the right.

    Question 2. Auto TARE is a little tricky.  You need to make sure that the result has settled to a true no-load.  The auto TARE sequence can start with the output values trending down, and then waits to stabilize for a period of time.  Once the system has stabilized you set the new TARE value.  The tricky part comes when you place some weight on the scale then remove a little without taking the full weight from the scale.  As an example let's say a customer wants to by a kg of bulk candy.  The store owner places a scoop of candy on the scale and it is a little more than a kg, so a little is removed attempting to get 1kg.  If the scale auto TAREs at the wrong time, the customer gets free candy and the shop owner loses money.  So, I would approach the condition as a state machine.  Draw a state diagram to cover the necessary conditions and then write the program to follow the state diagram.

    Best regards,

    Bob B