GE PACSystems RX7i Cpu Programmer's Reference Manual page 213

Hide thumbs Also See for PACSystems RX7i:
Table of Contents

Advertisement

Chapter 4. Ladder Diagram (LD) Programming
Example – Scaling Analog Input Values
A common application is to scale analog input values with a MUL operation followed by a DIV and
possibly an ADD operation. A 0 to ±10 volt analog input will place values of 0 to ±32,000 in its
corresponding %AI input register. Multiplying this input register using an MUL_INT function will result
in an Overflow since an INT type instruction has an input and output range of 32,767 to –32,768.
Using the %AI value as in input to a MUL_DINT also does not work as the 32-bit IN1 will combine 2
analog inputs at the same time. To solve this problem, you can move the analog input to the low
word of a double register, then test the sign and set the second register to 0 if the sign tests positive
or –1 if negative. Then use the double register just created with a MUL_DINT which gives a 32-bit
result, and which can be used with a following DIV_DINT function.
For example, the following logic could be used to scale a ±10 volt input %AI1 to ±25000 engineering
units in %R5.
An alternate, but less accurate, way of programming this circuit using INT values involves placing the
DIV_DINT instruction first, followed by the MUL_DINT instruction. The value of IN2 for the DIV
instruction would be 32, and the value of IN2 for the MUL would be 25. This maintains the scaling
proportion of the above circuit and keeps the values within the working range of the INT type
instructions. However, the DIV instruction inherently discards any remainder value, so when the DIV
output is multiplied by the MUL instruction, the error introduced by a discarded remainder is
multiplied. The percent of error is non-linear over the full range of input values and is greater at
lower input values.
By contrast, in the example above, the results are more accurate because the DIV operation is
performed last, so the discarded remainder is not multiplied. If even greater precision is required,
substitute REAL type math instructions in this example so that the remainder is not discarded.
198
PACSystems* RX7i, RX3i and RSTi-EP CPU Programmer's Reference Manual
GFK-2950C

Advertisement

Table of Contents
loading

This manual is also suitable for:

Pacsystems rx3iPacsystems rsti-ep

Table of Contents