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.

New Here? Please read this important info!!!


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

Reply
 
Thread Tools Display Modes
Old February 4th, 2015, 09:56 AM   #1
Tiller
Member
United States

Tiller is offline
 
Join Date: Jan 2015
Location: SC
Posts: 2
Indirect Addressing within a String in RSLogix 500

Hey, guys. I'm a co-op/intern at a company this semester, and I'm learning how to program PLCs. I'm using RSLogix 500 and a MicroLogix 1400 PLC to communicate with a ViewMarq display. I am trying to take a string from an ST file and place it into an N file to send to the display using a MSG instruction. It has to be a MSG instruction because I am communicating with the display via Ethernet which only supports Modbus TCP.

If I do a MOV instruction with something like ST15:6.DATA[0] as my source and N16:0 as my destination, it works fine. The problem is I would have to have like 65-80 MOV instructions each time. I am trying to use JMP and LBL to make a for loop to fill in the N file, but I keep getting an "ERROR: Usage of the 'Undefined' filetype is illegal" message.

What I have is ST15:6.[N7:0] as my source and N16:[N7:1] as my destination. Is there any way to do indirect addressing at the word level with a ST file so I can place it into the N file? I also tried ST15:6.DATA[[N7:0]], but that gave me an error saying the index had to be 0-40.

Any help would be appreciated.
  Reply With Quote
Old February 4th, 2015, 01:04 PM   #2
Doug-P
Member
United States

Doug-P is offline
 
Doug-P's Avatar
 
Join Date: Jun 2003
Location: Pa
Posts: 1,247
IIRC, the string offset must be a literal. So, you'll need a MOV for every two bytes/characters.
__________________
Let's eat Grandma!

Let's eat, Grandma!

Words are very important, but punctuation saves lives...
  Reply With Quote
Old February 4th, 2015, 01:28 PM   #3
Tiller
Member
United States

Tiller is offline
 
Join Date: Jan 2015
Location: SC
Posts: 2
Hey, Doug. Thanks for the reply.

If that's the case, is there a better way to go about getting a string into an integer file? I ask because I don't know if I'll always know how long the string will be. If I have a varying string length, which would mean I wouldn't know how many MOV instructions I would need ahead of time, what is the best way to get said varying string into an integer file?
  Reply With Quote
Old February 4th, 2015, 03:08 PM   #4
Doug-P
Member
United States

Doug-P is offline
 
Doug-P's Avatar
 
Join Date: Jun 2003
Location: Pa
Posts: 1,247
Quote:
Originally Posted by Tiller View Post
what is the best way to get said varying string into an integer file?
It won't be pretty.

Off the top of my head this is what I would try:
  1. Allocate an integer file to receive the converted data. Size it to accept the largest string expected.
  2. Allocate an integer to act as pointer into the destination integer file.
  3. Create a subroutine with enough similar sections to convert the largest string. Each section will do the following:
    • The string data (accessed with the literal offset) is moved to the integer using indirection - so you can put the string data at successive locations.
    • The pointer integer is incremented
    • The counter integer is decremented
    • IF counter = zero, JMP to end of SRTN or, do a RET
    • ELSE fall through to next section
  4. Move the string length to the counter integer.
  5. Call the subroutine
Someone else may have a better way.
__________________
Let's eat Grandma!

Let's eat, Grandma!

Words are very important, but punctuation saves lives...
  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
RSLogix Emulate 500 v 6.00 not opening RSS Saulo35 LIVE PLC Questions And Answers 6 November 30th, 2016 02:08 PM
RSLogix 500 - Bit Addressing jmaty23 LIVE PLC Questions And Answers 7 January 11th, 2013 10:19 AM
RSLogix 500 (ML 1400) COP String Problem keshik LIVE PLC Questions And Answers 3 June 10th, 2011 02:30 PM
PLC5 and Indirect Addressing kdcui LIVE PLC Questions And Answers 3 October 23rd, 2008 10:46 AM
RSLogix 500 Vs. RsLogix 5 mrdmrd LIVE PLC Questions And Answers 7 February 21st, 2005 06:11 AM


All times are GMT -4. The time now is 08:58 PM.


.