ABlearner

logix 5000 array

3 posts in this topic

Hi Guys!

I have a problem with array filling. I use rslogix 5000 software. I have to save the timestamp sometimes. I can save it with GET instruciton. Its a dint array which have 7 elements (year, month, day....and so on),  But my problem is I dont know, how can I solve that, they are in a bigger array. So like an array within the array. Idk it is possible ? I hope you know how I mean. 

So I have 7 dint value in one array, and I want 1000 array for this. How can increase the position of the array number ? 

Can anybody help me with that ? 

Thank you in advance.

 

Share this post


Link to post
Share on other sites

There are a lot of ways to skin this cat (no offense to cats) but I'll offer mine, create a UDT (User Defined DataType), I called mine DateTime and it looks like this:

Year    DINT    Decimal    Year    Read/Write
Month    DINT    Decimal    Month (1-12)    Read/Write
Day    DINT    Decimal    Day (1-31)    Read/Write
Hour    DINT    Decimal    Hour (0-23)    Read/Write
Minute    DINT    Decimal    Minute (0-59)    Read/Write
Second    DINT    Decimal    Second (0-59)    Read/Write
Microsecond    DINT    Decimal    Microsecond (0-999,999)    Read/Write

GSV is running in a structured text program that does a few other things. The top line is relevant to this post and it's all you would need.

***

GSV(WALLCLOCKTIME,,DateTime,CLOCK.Year );
GSV(FAULTLOG,,MinorFaultBits,Minor_Faults );
GSV(FAULTLOG,,MajorFaultBits,Major_Faults );
GSV(TASK,MainTask,LastScanTime,IO_Test_Info.Last_Scan );
GSV(TASK,MainTask,MaxScanTime,IO_Test_Info.Max_Scan );
GSV(TASK,MainTask,Watchdog,IO_Test_Info.Watchdog );

ITI.Last_Scan := IO_Test_Info.Last_Scan / 1000.0;
ITI.Max_Scan := IO_Test_Info.Max_Scan / 1000.0;
ITI.Watchdog := IO_Test_Info.Watchdog / 1000.0;

Flash.S := CLOCK.Second.0;
Flash.F := CLOCK.Microsecond.19;

OFF := 0;
ON := 1;

ID := 0; (* PID Increase / Decrease Control Action *)
II := 1; (* PID Increase / Increase Control Action *)

***

If you don't have structured text available you can call GSV in ladder. 

Then I create a tag called Clock and make it of the DataType DateTime

In your case the data type would be DateTime[xx] where the xx is the number of times you need to log the parameters in the Clock tag

I attached a screenshot of an example of what the tag would look like if it had an array size of 10 

Now you just increment a pointer and move the  Clock tag to the Test(x) tag, where x is 0, 1, 2, etc ie the incremented pointer

Tip: Don't get wordy with the Tagname. Ie don't make it TimestampCaptureArray or something like that. Use TSCA or something short and document it in the Description. Too many people try to describe the whole routine with the tagname :-/ That's what the description is. Long tagnames clutter up the program, make it a pita to troubleshoot, and make it look like you imported your program from a SLC or PLC5. I used to write novels with my tags. Then I started doing contract programming and it became clear that something had to change. Time is money, typing takes time.
 

DateTime Example.jpg

Edited by Michael Lloyd

Share this post


Link to post
Share on other sites

Thank you!

I have a question about this. First of all, I need to this in ladder logic. I made the GSV, its work properly. But how should I fill the array, as you showed on the pic ? 

Should I make a two-dimensional array, or need I an UDT at all events? Sorry, im slow..... :) haha

THank you again. 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now