RS500 Code question

snordvikqplas

Supporting Member
Join Date
Feb 2011
Location
Fort Wayne
Posts
28
Hello all

I have attached only a section of code (hence all of the eeee's) for a program I wrote a few years back and I am in the process of a final polish. The program has been working fine in production, however there is one thing that has always bugged me and I do not have an answer for it.

I basically wrote a program that stores a certain number of lengths in integer files, once the desired number of initial lengths (INTs) have been collected the program will shift all of the values down one space and bring in the new value.

Program would add all these values in order to get a "Running Rate" etc...

What I do not like and I think that I am mistaken in my code starts at rung 0001 in the attached section.

I used a ONS to execute several MOVs and DIVs only one time and at the end is an OTE. This OTE would advance to the next section where the shift would happen.

Notice the timer that I used to delay execution of rung 0004, I need this because all of the calculations and moves in Rung 0001 would not complete before the OTE caused the next set of rungs to be executed.

All I have been able to come up with as an explanation is the amount of time it takes for MOVs and DIVs to execute is longer than the OTE.

This is not a big deal in that the program works and I am able to execute exactly how I want, I am just throwing this out to some of you guys that have more experience and may be able to tell me that what I wrote is fine or explain why it happens.

Thanks in advance
 
The OTE, MOV, DIV, MUL instructions all execute immediately, One does not take longer then the others. they scan at different rates, but they all complete before the PLC moves on to the next instruction. The Timer on rung 003 is only keeping rung 004 from executing until the next scan. If rung 002 was moved below rung 004 and the timer was removed I bet you would see the same results.
 
Thanks for taking some time to look and reply.

I guess I am just confused as to why Rung 2 would happen and values that are calculated or moved in Rung 1 are not completed unless I do a slight pause. Values from Rung 1 are used in Rung 4, and if I took the timer out the values in Rung 4 would be incorrect. To me if all are calculated at the same time (scan) and Rung 4 cannot execute until the OTE in Rung 2 allows it then the values should be correct.

I apologize for confusion in writing this down, I have retyped several times :)

Would the problem be that I have a ONS (B3:6/3) before an OTE in Rung 0001
 
There is code not seen in this example so this is all speculation.

I don't think the ONS is the issue, it is basically turning the B3:6/1 into a ONS. I'm thinking that C5:2 and C5:4 used in the indexed addressing in rungs 004 and 005 are being changed to the correct values later in the scan.

Again this is only a guess, the best way to find it would be to walk thru the program step by step and see when C5:2 and C5:4 are being changed.
 
There is code not seen in this example so this is all speculation.

I don't think the ONS is the issue, it is basically turning the B3:6/1 into a ONS. I'm thinking that C5:2 and C5:4 used in the indexed addressing in rungs 004 and 005 are being changed to the correct values later in the scan.

Again this is only a guess, the best way to find it would be to walk thru the program step by step and see when C5:2 and C5:4 are being changed.

I agree with this.... and the program is not complete enough to make any more of a determination. We do not know where in the program C5:2 and C5:4 are being set. Also, the only value used in the program given from rung 1 is C5:1.acc. As you had said, the timer is basically delaying it one scan.

I think the problem is program order.
 
Last edited:
Hey guys

thanks for the responses, I appreciate any/all input.

I am backed up at work today but when I get a chance a I will rephrase what I am stating and include more of the code. I was attempting to keep my section of code shorter in order to be more clear. I know I have something wrong and I believe you are correct in that it is the order of operations.

Again thanks and I will get back to this soon because I do value the input you guys give.

Stu
 
Ok attached new file, reading what you guys have typed I wonder if the issue is that my indexed addresses are in another subroutine so I needed the delay. Basically like you have said I am out of order. Anyways when you get the moment to look feel free and again thanks
 

Similar Topics

Hello I am trying to make a program work with a sqo instruction .The process has 5 steps ,and a starting step of zero.There should be 8 sec...
Replies
17
Views
1,106
I have upgraded an old RS500 project to Studio 5000, it has thrown multiple errors which I am currently working through. I have looked through...
Replies
8
Views
1,741
I am working on upgrading a system with a ML1500 that uses a 1769-SDN DeviceNet Scanner to a CompactLocix L24ER-QB1B. Due to cost, I need to...
Replies
2
Views
1,416
I have been ask to check if we can have both English and Chinese in the same I/O description text window and rung comments. I could not Chinese to...
Replies
2
Views
1,223
Hi all, Here's an easy one. I've been asked to change a mitsubishi FX plc to a AB1400 using the same program. My customer has emailed me the...
Replies
5
Views
1,640
Back
Top Bottom