So I'm following a programmer who has done a few things that I don't completely understand. This is in a GE RX3i PLC. First of all, he used 250 ohm resistors for analog inputs, effectively making everything 1 to 5 Volts. In a GE PLC, that corresponds to 3200 to 16000 counts.
To convert to engineering units, rather than use floating point and y=mx+b, the previous programming did something I've never seen before. He combined a divide, subtract, multiply, and divide block. For instance, to convert 3200-16000 to 0-600: y=(x/8 - 400)(3/8). It looks like the point of this is to avoid an overflow when multiplying the x times the slope. A 3/8 has been factored out of what would be the normal y=mx+b equation.
My question is: is this commonly done?
My second question is: what about when you're going to something that's not a nice, even range. Like 0 to 1875 or something like that. How do you go about coming up with the equation in the form that I mentioned above?
Thanks.
To convert to engineering units, rather than use floating point and y=mx+b, the previous programming did something I've never seen before. He combined a divide, subtract, multiply, and divide block. For instance, to convert 3200-16000 to 0-600: y=(x/8 - 400)(3/8). It looks like the point of this is to avoid an overflow when multiplying the x times the slope. A 3/8 has been factored out of what would be the normal y=mx+b equation.
My question is: is this commonly done?
My second question is: what about when you're going to something that's not a nice, even range. Like 0 to 1875 or something like that. How do you go about coming up with the equation in the form that I mentioned above?
Thanks.