You are not registered yet. Please click here to register!


 
 
plc storereviewsdownloads
This board is for PLC Related Q&A ONLY. Please DON'T use it for advertising, etc.
 
Try our online PLC Simulator- FREE.  Click here now to try it.

---------->>>>>Get FREE PLC Programming Tips

New Here? Please read this important info!!!


Go Back   PLCS.net - Interactive Q & A > PLCS.net - Interactive Q & A > LIVE PLC Questions And Answers

PLC training tools sale

Reply
 
Thread Tools Display Modes
Old April 23rd, 2007, 11:52 AM   #1
rta53
Lifetime Supporting Member
United States

rta53 is offline
 
rta53's Avatar
 
Join Date: Feb 2003
Location: North Carolina
Posts: 600
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?
  Reply With Quote
Old April 23rd, 2007, 01:30 PM   #2
Peter Laing
Member
Canada

Peter Laing is offline
 
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
  Reply With Quote
Old April 23rd, 2007, 01:36 PM   #3
Mark Buskell
Member
United States

Mark Buskell is offline
 
Mark Buskell's Avatar
 
Join Date: Sep 2003
Location: Florida
Posts: 845
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.
Attached Files
File Type: zip emultest.zip (160.5 KB, 68 views)
__________________
"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."
  Reply With Quote
Old April 23rd, 2007, 01:56 PM   #4
Mark Buskell
Member
United States

Mark Buskell is offline
 
Mark Buskell's Avatar
 
Join Date: Sep 2003
Location: Florida
Posts: 845
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."
  Reply With Quote
Old April 23rd, 2007, 02:28 PM   #5
curlyandshemp
Lifetime Supporting Member
Canada

curlyandshemp is offline
 
curlyandshemp's Avatar
 
Join Date: Jul 2005
Location: Toronto
Posts: 1,612
Quote:
Originally Posted by rta53
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

__________________
Work to Ride,
Then Ride to Work
  Reply With Quote
Old April 23rd, 2007, 05:47 PM   #6
rta53
Lifetime Supporting Member
United States

rta53 is offline
 
rta53's Avatar
 
Join Date: Feb 2003
Location: North Carolina
Posts: 600
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.
  Reply With Quote
Reply
Jump to Live PLC Question and Answer Forum

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

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


All times are GMT -5. The time now is 02:23 AM.


.