I've got a problem with a output signal from a load cell. In my program it's represented by unsigned word (U16) (This can't be changed). When loadcell gives an positive output signal it's represented from 0 (+0 kg) to 65535 (10 kg). When negative it's represented from 65535 (-0 kg) to 0 (-10 kg). How can I in a simple way make this signal curve linear?
I hope you made a mistake. By your description, 5 kg will give 32768, and -5 kg will also give 32768! If your load cell really outputs only an unsigned (U16) number, there is no way to distinguish positive loads (compression) from negative (expansion) -- you'd need a 17th bit to do that.
Check the mapping between loads in the -10 kg to +10 kg range again. That's a 20 kg range that needs to be mapped into a 16-bit signal, so 10 kg can only map into 15 bits (0-32767).
No, read my post again. It's correct what I write. I need to make some kind of logic to keep track of when over and under 0 kg. This is what I need to get a straight curve.
But how do you know (unless you use some reading from somewhere other than the Load Cell) whether you are over or under 0 kg? As I noted, +5 kg and -5 kg will both give you exactly the same Load Cell reading, so unless you have another way to indicate the sign of the reading (which amounts to a 17th "bit" of information), you are out of luck. Note that (as I noted) you could have things set up so there is a Front Panel Boolean switch that says "Compression" (positive load) and "Tension" (negative load) that could act as the "missing Bit", but if you think about going from 5 kg compression down to 0 down to 5 kg tension, as you describe the Load Cell, what you'll see is a decreasing value down to 0 followed by a discontinuity as it jumps to 65536. You could say "If I see discontinuities, I'll know I'm playing around 0", but you'll still have "sign" issues ...
P.S. -- could you please tell us the name and model of this Load Cell? I want to see how the manufacturer describes it to see if it really is "cheating" by sending 17-bit data using 16-bit encoding ...