Indirect Addressing within a String in RSLogix 500

Tiller

Member
Join Date
Jan 2015
Location
SC
Posts
2
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.
 
IIRC, the string offset must be a literal. So, you'll need a MOV for every two bytes/characters.
 
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?
 
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.
 

Similar Topics

Howdy folks, I am an Allen Bradley guy currently living in an Emerson world. Working with Rx3i on PacSystems Machine Edition v. 9.6? i think...
Replies
3
Views
577
Hello, I'm very new to programming with absolutely zero schooling in this field and pretty hands off training in my new role, it's been fun...
Replies
4
Views
649
Hello Friends, I am trying to index M Bits, however GX Works2 is not allowing it with following message. https://ibb.co/zPcqj6M...
Replies
3
Views
1,299
Hi All, which the best way to do the indirect addressing in an optimize DB? Ccurrently this is my partial code inside an FB...
Replies
7
Views
2,250
Hey everyone, Just used the PLC5/Logix migration utility to convert a program, and while addressing the PCEs, I noticed a lot of errors for "XIC...
Replies
12
Views
1,902
Back
Top Bottom