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 January 21st, 2020, 03:37 PM   #1
instruward
Member
Canada

instruward is offline
 
Join Date: Jul 2019
Location: Prairies
Posts: 16
How to change MOV source destinations dynamically?

I apologize, I don't know how to word my question properly.

See code snippet for reference: https://imgur.com/a/yPOohZ9

I have an old panelview PB32 program I'm trying to covert over to FactoryTalk. There is a 20 character product code that I need to convert in the PLC so my new HMI can read it.

Currently it stores the characters in N240:20 through N240:29 (for product code #1), for a total of 20 characters. I found some example code online to convert that over to a ST (string) data file.

I am trying to figure out if I can make the attached code be reused for all product codes (over 30).

Like if product 1 name sourced from N240:20 through N240:29, and the destination is ST9:0.DATA[0].

How I can make the attached code's MOV references switch to N240:60 through N240:69, and ST9:1.DATA[0] for product code #2.
  Reply With Quote
Old January 21st, 2020, 04:01 PM   #2
ASF
Lifetime Supporting Member
Australia

ASF is offline
 
Join Date: Jun 2012
Location: Australia
Posts: 3,072
I think what you're looking for is indirect addressing.


For example, assuming recipe 0 is stored in N240:60, recipe 1 is stored in N240:61, and so on...recipe 9 is stored in N240:69.


In some other register - say, N7:0, you have the required recipe number. E.g. if you need recipe 6, then N7:0 = 6.

You need to add 60 to get it into the correct range (because your recipes start at N240:60, not N240:0), so ADD N7:0 plus 60 store result in N7:1. Now N7:1 = 66.

Then your syntax for the MOV source is N240:[N7:1]. If N7:1 = 66, then the source will be evaluated as N240:66.

Disclaimer: it's been a long time since I did indirect addressing on the Logix 500 platform. I have a vague memory that you might need to precede the indirect address with a # symbol or similar on that platform. In any case, if what I'm describing is what you're after, search for "indirect addressing" and you'll find plenty of information on the subject, now that you have the right keywords
  Reply With Quote
Old January 21st, 2020, 04:23 PM   #3
instruward
Member
Canada

instruward is offline
 
Join Date: Jul 2019
Location: Prairies
Posts: 16
Yes exactly, thank you. Indirect addressing.

So yea the confusing part is that 1 product name spans N240:60 to N240:69.
The old panelview HMI read the data in as a character array.

I've figured out how to concatenate the data into 1 string file per product code.

I obviously need to do some reading, I've been trying to use the MOV function with the destination of ST9:#[N7:93].DATA[0]. But it doesn't like me inserting #[N7:93] there, not sure yet what I am doing wrong.
  Reply With Quote
Old January 21st, 2020, 06:01 PM   #4
drbitboy
Lifetime Supporting Member
United States

drbitboy is offline
 
drbitboy's Avatar
 
Join Date: Dec 2019
Location: Rochester, NY
Posts: 356
Quote:
Originally Posted by instruward View Post
Yes exactly, thank you. Indirect addressing.

So yea the confusing part is that 1 product name spans N240:60 to N240:69.
The old panelview HMI read the data in as a character array.

I've figured out how to concatenate the data into 1 string file per product code.

I obviously need to do some reading, I've been trying to use the MOV function with the destination of ST9:#[N7:93].DATA[0]. But it doesn't like me inserting #[N7:93] there, not sure yet what I am doing wrong.
in this manual it says "You cannot use indirect addressing with: S, ST, ... files" - that is MicroLogix 1100 though, so maybe that limitation is not applicable to your hardware?

update: ML 1400 manual does not have that constraint for ST ...

Last edited by drbitboy; January 21st, 2020 at 06:05 PM. Reason: add ml1400 note
  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
Change RACK ID on Kepware dynamically !! amitgolwala LIVE PLC Questions And Answers 1 June 30th, 2011 08:19 PM
stoplight crosswalk problem tczjr5 LIVE PLC Questions And Answers 2 April 11th, 2009 11:24 PM
Move Thru Mask LIVE PLC Questions And Answers 12 May 13th, 2004 07:39 PM
S7-413 wont change MPI adress. JesperMP LIVE PLC Questions And Answers 6 May 21st, 2003 04:02 PM


All times are GMT -5. The time now is 10:27 PM.


.