Index String Array in RSLogix 5000

rta53

Lifetime Supporting Member
Join Date
Feb 2003
Location
North Carolina
Posts
619
I would appreciate some help with how to index a string array in RSLogix 5000 v16. I have to create a date and time string but the month has to be in the format of Jan, Feb, etc. I created an array tag I called month_array with 13 elements. I used 13 so I could equate 1 to 12 with Jan to Dec. I will use a compare instruction such as date_month = 4, then index the array to Apr. How do I do this?
 
Will you be sending this to a PanelView Plus.
If so and you can use structured text, look at this program.
If takes the WALLCLOCKTIME and formats it and places the result
in SDateTime in the form of Mar. 07, 2007, 02:47:35 P.M.
You will have to modify to fit your needs.

I didn't write the original but modified this version to fit my needs.
 
Also, if you just want it local, use a
COP function.
Copy StringConst[test4] to stringtest with a length of 1.
test4 is a DINT, I put a 4 in it and it then copied Apr. to
my stringtest.
 
rta53 said:
I would appreciate some help with how to index a string array in RSLogix 5000 v16. I have to create a date and time string but the month has to be in the format of Jan, Feb, etc. I created an array tag I called month_array with 13 elements. I used 13 so I could equate 1 to 12 with Jan to Dec. I will use a compare instruction such as date_month = 4, then index the array to Apr. How do I do this?




Clock[1] contains the month #
Month[] is a string array of Month text,
Month[1]= "Jan"
Month[2]= "Feb", etc

month_index_1.jpg
 
Thanks for all the help. I have gotten most of this figured out but my problem now is how to format the date/time in the way the customer wants it. This is what they told me they want:

System1_23-Apr-07093008 which is 2007-9:30:08 AM

I can do the part up to the year with no problem. I shortened 2007 to 07 by using the string DELETE instruction. I can change the month. The problem now is how to deal with adding in the zeros when the hours and minutes are less than 10 and then removing them when the hours and minutes are greater than 9. I tried using the INSERT instruction but that just creates a mess. Hopefully I can leave off the seconds. What's the best way to do this? I have to do it in ladder.
 

Similar Topics

Hi everybody. I got some problems about how to perform this task Now, I got an FB where I have this code snippet that looks like: L P##DBD_134...
Replies
5
Views
1,128
I am using a function block that has a in/out parameter that is a structure. The structure has an array as one of the elements. I can index the...
Replies
1
Views
736
Hi all, I have an Allen Bradley PLC which is connected to a Kinetix 300 drive. I have been using MotionView to adjust the different positions...
Replies
3
Views
1,272
Sorry for the word salad title, I'm having trouble putting my problem into words. Basically I have two arrays of DINTs, both the same size...
Replies
29
Views
7,967
Hi all, I'm working on developing a 90° valve actuator system that will actuate valves several hundred times for some testing. The PLC (an AB...
Replies
23
Views
7,205
Back
Top Bottom