AD260 VS AB1500, This is how to add up 60 words in AB?

piscis

Member
Join Date
May 2003
Posts
241
Using a single instruction I can add up these 60 single-word registers on AD. On AB1500 I need to use 60 instructions. Does anyone know if AB1500 has an instruction similar to AD.

Thanks

8-16-2009 9-53-00 AM.jpg 8-16-2009 9-54-29 AM.jpg
 
Nope...

You have to loop and add, or repeat the add multiple times. Using the JMP LBL as in my example will hurt scan time much more than the brute force method of 60 consecutive add instructions.

Also make sure you don't overflow the integer location for your sum. You might need a double integer depending on the values the source data is likely to contain.

Paul

ML_For_Next.jpg
 
You have to loop and add, or repeat the add multiple times. Using the JMP LBL as in my example will hurt scan time much more than the brute force method of 60 consecutive add instructions.

I would still use this method, except without the loop, why not just do the math every scan, for 60scans and repeat? 60 instructions like that is just painful.

Of course it means that the result won't be available straight away, but shouldn't take too long, what is the average scan time of a ML1500?
 
How about a CPT Compute

Help says it is compatable with the following so it may not work for you.
SLC 5/03 OS302
SLC 5/04 OS401
SLC 5/05
MicroLogix 1400 Series A


N7:12+N7:13+n7:14+...
Destination N12:0


Expressions - The expression is zero or more lines, with up to 28 characters per line, up to 255 characters. Instructions that can be used in the Expression include: +, -, *, l (DIV), SQR, - (NEG), NOT, XOR, OR, AND, TOD, FRD, LN, TAN, ABS, DEG, RAD, SIN, COS, ATN, ASN, ACS, LOG, and ** (XPY). The execution of a CPT instruction is longer than a single arithmetic operation and uses more instruction words.

You can also use indirect or indexed addressing but it seems to me you would need to do one ad per scan using those.
 
A 60 place SUMBCD still has to execute the ADD 60 times. It's just hidden inside the IBox instruction. All you save is the ladder printout space.
 
How large is your N11 data table? And remember, the data table is 0 based, so a 60 element table can only be addressed 0 to 59.

Oh, never mind that (well, it's a valid comment)... You never set your index back to 0. So, it's going to try to read completely non-existent addresses as the program scans. You don't want to initialize your loop counter only on the first pass, but every single scan before you do any computational work with indirect addresses.
 
Last edited:
Now that I'm initializing my loop counter, I'm getting this other error, any idea will be highly appreciated.

Thanks all!!

8-17-2009 7-46-22 AM.jpg
 
I have no idea why I'm getting 32,767 on N9:1 when all the values inside the N11 register are the same, 55 so the total should be 550.
 
You are only clearing your sum (N9:1) on first scan. Remove that condition and you will get what you expect. If that value is used by an external application, then you'll want to use a separate integer for your total, then MOVe it to the normal location after the totalizing loop.
 
OkiePC

Thanks a lot, that did it. Now I have to sit down and try to understand why I have to clear the sum on every scan!!!

Thanks all!
 

Similar Topics

Hello All, I'm new here so pls bear with me. :) I have an AB1500 PLC and I am trying to use the PWM or PTO function to control the speed of a...
Replies
7
Views
3,314
Does anyone knows if the PLC AB1500 has a nice instruction like the AutomationDirect Ibox “INC” instruction, (increment) where you can use it as a...
Replies
4
Views
2,078
Does anyone know if AB1500 PLC has an instruction like this one in AD “Filter Over Time - BCD (FILTER) IB-422” Or may know how to accomplish the...
Replies
5
Views
2,427
I’m working on two “Energy Consumption” projects for two different customers with two different PLC; AB1500 and AD260, the two most popular PLC in...
Replies
1
Views
1,972
I need to start working on an HMI project using AB1500 with Citect. I would need at least 3 drivers to connect to PLC using DF1, Vision System...
Replies
1
Views
1,580
Back
Top Bottom