Using ADD function

viopo

Member
Join Date
May 2003
Posts
6
Hi All,

I am new to PLC and this forum as well.

I was trying to programme an ADD function in PLC 5 of AB. The source 1 is set as N7:0 and source 2 as N7:10 and the Destination is pointed to N7:12. There are values at N7:0 and N7:10. But when the rung is true, I am not getting the result in N7:12. What could be the problem?
Any help?

Thanks,

Viopo
 
Several Culprits

1) Is the rung in a program file other than LAD 2, and is there a JSR to the program file? (i.e., is the rung actually being scanned by the PLC?)

2) Is N7:12 being used elsewhere in the program? Don't just rely on a search - do a cross-refernce as well. It may be that you have a File instruction (COP, FLL, etc) that includes N7:12, but doesn't reference it directly. A cross-ref will show that. But it won't show indirect addressing, so watch for that as well.

3) Could the values in N7:0 and N7:10 be different from what you think they are supposed to be immediately prior to the rung being scanned? N7:0 could be '11' for the entire scan, but in the rung before the ADD, if something should change it to '47', and back to '11' after the ADD, '47' will be the value used, even though while you are online monitoring it, it will appear to be '11' all the time. You might want to monitor the registers with a histogram.
 
Thanks for your quick reply.

1. It is in LAD 3, being scanned and executed by PLC. In this simple rung there is a XIC (a hardwired switch) which energises the rung. During running mode the energised condition with XIC is shown but now result available at destination.

2. No other programme using the integer table. LAD 3 contains only one rung and LAD 2 contains binary table and direct descrete i/o operations.

3. I dont find any chance for over-writing the result with another value immediately after the ADD operation, since the integer table operation is done only by this ADD function.

Please provide possible help. I shall send you the program if required

Thanks,

Viopo
 
Another possible culprit

What values are in N7:0, N7:10 and N7:12? Could the sum of the two source register values be greater than 32767?

I can't remember the behavior of the PLC5 if the sum of the two integers is too large to fit in the destination register. In some PLCs the value of 32767 will be placed in the destination register and the overflow bit set. In other PLCs, the value in the destination register will be unchanged, but the overflow bit will be set.
 
Just to satisfy us sceptics, do a quick search as shown below. Type "JSR 3" in the search box, and click "find all".

I know that is not the only way to scan a sub, but it is the most likely.

rslogix.gif
 
Don't forget MCP

Since he's using a PLC-5, there doesn't HAVE TO be a JSR for the LAD file to be scanned. If he enters a '3' in one of the MCP registers (S:80, 83, 86, etc - See Processor Status, MCP tab) the ladder file will executed.

There are other possible culprits (knowing that the rung conditions are actually indeed TRUE at the instant the rung is scanned for instance).

All we can do is wait until he posts his code to see if something obvious jumps out.
 
Or better yet......

Install a branch around the ADD instruction with a OTL using any bit that is not used elsewhere in the program. See below.

I say you Zip the .rsp file and attach it. You will get quick answers.

rslogix2.gif
 
What is with the over-use of the word "Culprit" in this thread?

Originally posted by
Since he's using a PLC-5, there doesn't HAVE TO be a JSR for the LAD file to be scanned. If he enters a '3' in one of the MCP registers the ladder file will executed.

Could also be an STI (S:31).There doesn't have to be a JSR with a SLC either. That is why I said:

I know that is not the only way to scan a sub, but it is the most likely.

But, point understood. check out my second solution.




Edit:
Also, I am surprised no one pointed out that in my first post, I was using RSLogix500....
:D
 
Last edited:
You need to determine if N7:12 is available, it may be used by a diagnostic file or BTW or some other instruction.

While in the RUN mode.
* Remove or branch around the rung conditions.
* Try entering a value into N7:12 manually.
* Then try AFI the rung and try entering a value into N7:12.
* Try changing N7:12(destination) to an address that is far removed from N7:12, just in case it is used in some file function, to be absolutly sure that the address is free you can create a NEW address.(program mode to create a NEW address)

By the way what is the value being shown in N7:12, anything?

Roger
 
Last edited:
Have already spooked him with the plethora of information here.....




Had an issues the other day with a SLC 5/03 where in RSlogix500 I had added another program file and got all of my logic in and all the inputs were making but none of the outputs would come on and then I realized that the program file was not even in the scan cycle.....so had to add a JSR to get it to run........can you accomplish this by any other means?


Steve
 
Selectable Timed Interrupt

You could run the "new" file as an STI. Of course, an STI is more for a time critical process. When you use an STI you must also specify how often it will scan. It IS NOT part of the regular scan. Every [S:30] (setpoint in ms) this file will scan.

So your JSR was the best way to go.

status.gif
 

Similar Topics

Hey everyone, I am new to using the LogicMaster 90-30 software for the GE Fanuc 90-30 PLC, and I needed some help in incrementing registers...
Replies
16
Views
5,920
Hi, I am developing a HMI Screen using FTVIEW SE and collecting Data from GE PLC using Kepware. Now, I want to add a total hours Counter that...
Replies
2
Views
1,332
under rslogix and IO configurations, you use that to add modules for digital and analog. and for various types of those modules, such as...
Replies
10
Views
2,697
There are multiple ways to skin a cat, but obviously there are some differences between using making Add-Ons and using a FOR loop to jump though...
Replies
5
Views
2,228
I have a 06 AD PLC and I need to add values which are greater than 9,999, so I’m using 60 double words starting at V4000. I did the code using the...
Replies
6
Views
1,878
Back
Top Bottom