We have solved it! We had arranged the bits in the correct order (they where all mixed up), so that wasn't the problem. My college sketched a graph with Dist in mm as X-axis and AI-value as Y-axis. Why did the graph bend upwards at the end and became so non-linear?? Gee it looks like a 2nd degree equation. He started solwing it to get the coefficients. And when we implemented the calculation in the code it resulted in an perfect measurement!! As I have understod it In Siemens S7 you get the value as an integer which is linear and represent the measured value. So Siemens must perform this type of calculation "inside" of their software. This isn't mentioned in any manual of course, why help a competitor, Mitsubishi. Anyway, many thanks for your help guys, now we can return some info to you! // John and Jörgen