wildswing
Member
Hey fellas,
I'm down to my last bug in an RSL5k ladder program converted from RSL5. In the 5 there's a DIV that divides an INT, by an INT and stores it in an INT. The subsequent logic depends on how it rounds off the result.
Now in 5000 I see that the DIV does not round. It truncates. This was screwing up the logic that depends on the properly rounded off result.
My solution was to put the result of the DIV into an intermediate REAL, then MOV the REAL to the original destination INT. See attached. This seems to work ok when I simulate the process. I'm just checking with y'all to see if you see anything wrong with doing it this way.
I'm down to my last bug in an RSL5k ladder program converted from RSL5. In the 5 there's a DIV that divides an INT, by an INT and stores it in an INT. The subsequent logic depends on how it rounds off the result.
Now in 5000 I see that the DIV does not round. It truncates. This was screwing up the logic that depends on the properly rounded off result.
My solution was to put the result of the DIV into an intermediate REAL, then MOV the REAL to the original destination INT. See attached. This seems to work ok when I simulate the process. I'm just checking with y'all to see if you see anything wrong with doing it this way.