![]() |
||
|
This board is for PLC Related Q&A ONLY. Please DON'T use it for advertising, etc. |
||
| ||
New Here? Please read this important info!!!
|
|
#1 |
|
Lifetime Supporting Member
|
Index String Array in RSLogix 5000
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?
|
|
|
|
#2 |
|
Member
![]() Join Date: Oct 2005
Location: BC
Posts: 24
|
Use a DINT tag for the index.
Use the COP instruction as shown in the attached screen capture. Cheers, PL |
|
|
|
#3 |
|
Member
|
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.
__________________
"Take whatever idiot they have at the top, give me a better idiot. Give me a caring idiot. Give me a sensitive idiot. Just don't give me the same idiot." |
|
|
|
#4 |
|
Member
|
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.
__________________
"Take whatever idiot they have at the top, give me a better idiot. Give me a caring idiot. Give me a sensitive idiot. Just don't give me the same idiot." |
|
|
|
#5 | |
|
Lifetime Supporting Member
|
Quote:
Clock[1] contains the month # Month[] is a string array of Month text, Month[1]= "Jan" Month[2]= "Feb", etc
__________________
Work to Ride, Then Ride to Work |
|
|
|
|
#6 |
|
Lifetime Supporting Member
|
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. |
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Topics
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| PID Control Action Mode in RSLOGIX 5000 | plcnovel | LIVE PLC Questions And Answers | 7 | January 19th, 2011 08:30 AM |
| RSLogix 5000 array tags (I/O points) | Vuli | LIVE PLC Questions And Answers | 2 | May 4th, 2006 10:14 AM |
| RSLogix 5000 V15 Features | Samneggs | LIVE PLC Questions And Answers | 18 | April 20th, 2006 05:45 PM |
| Newbie RSLogix 5000 | Paully's5.0 | LIVE PLC Questions And Answers | 6 | January 12th, 2006 05:02 PM |
| S7 - Index for Array Variables in ProTool | RMA | LIVE PLC Questions And Answers | 2 | August 26th, 2005 03:55 AM |