How to program PLC5 to calculate difference in percent

mlash1

Member
Join Date
Aug 2012
Location
New York
Posts
3
Hi everyone,
I need to program a PLC 5 to calculate the difference in percent between the highest and lowest of either 2 or 4 floating point values so it can be displayed. For example, the 4 values might be: 225.1, 225.5, 225.8, 225.3. The math looks like this: 225.8 (highest value) minus 225.1(lowest value)= 0.7, then 0.7 divided by 225.1 (lowest value) = 0.0031097, times 100 = 0.31097 %. I am sure there is a way to do this but I haven't been able to figure it out. Thanks very much!
 
Welcome to the forum.

Which PLC/5 are you using?

If you are using an enhanced PLC/5 (models ending in 0 rather than 5, such as 5/20 or 5/40) then use the SRT command. Move the four values into four consecutive registers and then sort those registers. The lowest value will be in first register and the highest value will be in the last register. From there you can use the CPT instruction or conventional math instructions.

If you are using a non-enhanced PLC/5 then you'll have do do a series of brute force compares to find the min and max, still pretty easy to do with just four numbers.

edit: See attached. First six rungs are for an enhanced PLC/5. The rest are for a non-enhanced PLC/5.
 
Last edited:

Similar Topics

Hi guys, Is there anywhere to calculate a redundant PLC-5 program size when converting them into CLX (redundant)? 1) In PLC 5 lets say I have...
Replies
13
Views
5,535
Plant PLC has no reasonable stop start sequencer. There is 3 states, Available, Start & Stop. A 10 sec timer exists in the Stop Ladder that is...
Replies
8
Views
2,702
It's a PLC2/30 system, besides the regular I/O, it has a 1771-VHSC, 1771-KA2, and 1771-KE. You can PM me. TIA.
Replies
1
Views
1,533
I had a problem yesterday, the PLC5 lose the program, I did new download and re-start the process. Today, I get the crash log and I do not...
Replies
1
Views
2,455
dear all, I have question, i realy need to help from everyone. Which cable I can use for upload/download program from PLC5/20 to Computer...
Replies
4
Views
2,145
Back
Top Bottom