Calculating the out-of-range flag using the scale – Rockwell Automation 1746-XXXX SLC 500 4-Channel Analog I/O Modules User Manual User Manual
Page 65

Publication 1746-UM005B-EN-P - June 2004
Programming Examples 6-3
Calculating the Out-of-Range Flag Using the Scale Instruction
Use the following equation to calculate the low and high limit input
values which determine the out-of-range flag.
Input value = (scaled value - offset) / slope
low limit (275 - 100) / (400/32,767) = 14,344
high limit (300 - 100) / (400/32,767) = 16,393
Once you have calculated the linear relationship and the out-of-range
flag value, this example allows you to:
•
Turn on a heater or fan to maintain the process temperature
between 275° and 300° C by using the out-of-range flags.
•
Monitor the process temperature using a Data Table Access
Module (DTAM) or Hand-Held Terminal (HHT).
•
Output the process temperature for operation interface purposes
by:
– MOVing the scaled value to an output module as variable
data to a Dataliner
– Converting the scaled value to BCD (using TOD instruction)
and MOVing it to an LED display
The following ladder diagrams show how to program the processor.
The first example uses standard math instructions available in any SLC
500 processor. The ladder diagram prevents a processor fault by
unlatching the mathematical overflow bit S2:5/0 before the end of the
scan.
The second example uses the scaling instruction (SCL)
➀
available in
the 5/02 and higher processors. The rate parameter is calculated by
multiplying the slope by 10,000.
rate = (400/32767) x 10,000 = 122
If the result of the Source times the Rate, divided by 10000 is greater
than 32767, the SCL instruction overflows, causing error 0020 (Minor
Error Bit), and places 32767 in the Destination. This occurs regardless
of the current offset.
The third example uses the SCP (scale with parameters) instruction
available in the SLC 5/03 (OS302 or later), SLC 5/04 (OS401 or later),
and SLC 5/05 only.