Help with Clearing an array in CCW

Tim114

Member
Join Date
Apr 2018
Location
Cookeville
Posts
2
Hello all,
I'm working on my first project with an Allen Bradley Micro 810 using the connected components workbench. Everything is going well so far, but I've
reached a point where I can't seem to progress.

I am using a load cell(amplified) and a set of TON blocks to create an array with known time steps and recorded load cell values for each step. The Array is a DINT[0..100] and seems to be working fine. The problem I need to solve is that every cycle it needs to reset to zero initial value to be able to store new values from the load cell.

Since the COP command does not seem to be implemented in this build of CCW, I was trying to use a MOV to replace the terms of the Load_Cell_Array with an equivalent array of zeros. I have not succeeded in this and found an article on the Allen Bradley knowledgebase(#531939) that suggests using structured text to iteratively replace each Load_Cell_Array value with zero.

I do not yet know how to fix this using ST. I've cobbled together some code that I will paste below, but it shows several errors when I try to build.

If anyone has has a similar experience or has some input on this I would greatly appreciate it.

Thanks in Advance
-Tim




"
PROGRAM Zero_Array
VAR
i : DINT;
VarInput1 : DINT[0..100];
END_VAR;

FOR i := 0 TO 100 BY 1 DO;
VarInput1 := 0;

END_FOR ;

END_PROGRAM;
"

where 'VarInput1' is a connection point on the function block you select 'Load_Cell_Array'
 
Well your almost there, just some tweaking.

Make sure your "Load_Cell_Array" is GLOBAL, DINT, [0..100].

Now create a UDFB for Structured Text, and create the "i" index variable as DINT, within the function block scope

Place this code in the function block

FOR i := 1 TO 100 BY 1 DO
Load_Cell_Array := 0;
END_FOR;

Build (Should be error free)

Now anytime you want to clear the Load_Cell_Array just place this "ClearArray" function block on your ladder rung and it will clear the array.

I hope this helps.

ClearArray.jpg
 
Thanks for the input. It built correctly.
I had missed the part about creating a local variable in the custom block for i : DINT

build errors.jpg
 
Last edited:

Similar Topics

I'm fairly new to Rockwell software, I've had some basic training in the past but nothing too advanced. My company and I use Reliable products for...
Replies
0
Views
9
Hi all I need help on this As in my project used Schneider TM241 controller. Now I want to communicate Elite energy meter with controller by...
Replies
3
Views
78
Hi all, I am having issues accessing my Cimplicity software - the site code changed after re-install and I am no longer able to attain a new key...
Replies
10
Views
107
Good day all! Can someone help me with the procedure to update Beijers E700 firmware? The Panel I am working on is firmware 2.04v and I would...
Replies
1
Views
49
Hi, We have an application that has a device that goes through a reboot (appears un-graceful) What then happens is the MVI module appears to hang...
Replies
0
Views
58
Back
Top Bottom