Rockwell - Convert Two INT to REAL

Theres an error in his code...110 - 56×2 yields a negative index, faulting the FAL. Change the count from 56 to 55 in the FAL.

The array at 112 was likely your only fault. Can probably set the FAL back to 56. I forgot the FAL starts at 0, so the last index should be 55, for a length of 56.
 
Well done everyone finding the problem, sorry I was not more explicit about the extra element in the INT array.

If this is going into production, you should use Ken Roach's approach; Code Golf may be fun, but it does not maximize profit.
 
Well done everyone finding the problem, sorry I was not more explicit about the extra element in the INT array.

If this is going into production, you should use Ken Roach's approach; Code Golf may be fun, but it does not maximize profit.

Always fun to see your solutions. You have some creative ones. I initially thought at the beginning of this thread that a FAL could do it one rung, but would have taken a minute if ever to think of offsetting the evens ahead of the odds. Real world I probably would have immediately did a FOR NEXT like Ken, if not brute force of 56 rungs. My time is money and if it works and is legible by a tech, I move on quickly.
 
I can simulate something.

intarray[0] = 17332
intarray[1] = -22938

That should give

realarray[0] = 361.3

Right now it's realarray[0] = 5.97 e-41 since it's reading only intarray[1]

If I put intarray[2] = 17332 then

realarray[0] = 361.3

I don't know where to change the offset.

Sans titre.jpg
 
I can simulate something.

intarray[0] = 17332
intarray[1] = -22938

That should give

realarray[0] = 361.3

Right now it's realarray[0] = 5.97 e-41 since it's reading only intarray[1]

If I put intarray[2] = 17332 then

realarray[0] = 361.3

I don't know where to change the offset.

View attachment 68650

Your FAL is wrong. Should still be 112-, not 113. Only the array needs to be size 113.
 
Put the FAL back exactly like it was....112- and 110-, and the length 56. Just make sure your array is defined as 113 elements, not 112.

The FAL needs an extra spot to move the 111th element [110] to the 113th element [112]. So the array needs to be one size bigger.
 
Back to that, there is still an offset issue somewhere where it's building REAL 0 with INT 1 and 2 instead of 0 and 1.




Sans titre.jpg
 
Back to that, there is still an offset issue somewhere where it's building REAL 0 with INT 1 and 2 instead of 0 and 1.




View attachment 68651

Probably because the FAL is constantly executing while you're populating the values. Humor me and will help you trouble shoot.

Create an array of 112 called myData of type int. Put your raw values in here. Do a COP of 112 from Mydata[0] to Intarray[0] in the same rung ahead of the FAL. You should see the order of intarray swap..

Your Mydata[0] will equal intarray[2] and Mydata[1] will equal intarray[1]. The final COP will convert intarray[1] and [2] now swapped, to the real.
 
Last edited:
Anyway, I'll probably be using Ken's logic.

I just need to know how to actually call that routine with the FOR, toggling it by hand is not a viable solution.

Any suggestion about that?
 
Anyway, I'll probably be using Ken's logic.

I just need to know how to actually call that routine with the FOR, toggling it by hand is not a viable solution.

Any suggestion about that?

How often do you need the data to refresh? Just put a blinking bit on the FOR call.
 
As for the FAL, doesn't look like it's executing....I can't remember off top of my head if it needs a false to true to execute. You might try putting a blinking bit in front of it too.
 
How often do you need the data to refresh? Just put a blinking bit on the FOR call.

There are 3 analog values that I care a little more about the refresh rate. 2 are from 4-20mA loops, and the 3rd one is located in that array.

I run a PWM where the feedback is the MW value, and if it's not refreshing quickly enough, the PWM will time out because of oscillation.

That would probably still work refreshing each second and playing with deadband, but I'd prefer something like every 5 scans. I yet don't know how to do it, but I'll find something.

But I just want to know; does it needs a trigger to refresh? What happens if the FOR is just always on?
 

Similar Topics

I'm trying to convert an RS Logix 500 fille when I open the 500 file and try to "save as" a .slc file, it does not allow it. It says " SLC library...
Replies
7
Views
696
Hi All, I have several ACD files & L5X files, I would like to read the contents of these files, however I do not have Rockwell Studio 5000...
Replies
6
Views
2,318
Hello all, A group I am involved with is just completing converting a Siemens APACS control system over to an RSLogix PLC. The subject came up of...
Replies
1
Views
1,217
I have a RSlogix 500 I'm trying to convert to Rslogix 5000 and the utility wants a .slc file to work from. when I open the 500 file and try to...
Replies
1
Views
3,251
Hi, I have a Rockwell PLC progrma using L64 in the field, I need to convert to L62 in office for testing, but program is not responding while...
Replies
2
Views
1,511
Back
Top Bottom