Sign in to follow this  
Followers 0
Rod_Hackney

S7-300 Indirect addressing programming

5 posts in this topic

I have a S7-312 processor and have an application that needs to index through and convert 40 DINT's to S5Time format. I have used FC 40 and using the pointer register to read and write to the FC block in the code below. But I need to be able to increment through the the memory words to process all 40 entries. I am new to S7 any suggestions appreciated. L P#0.0 T MD 0 L P# 160.0 T MD 4 L DBD [MD 0] T MD 12 Call FC 40 IN :=MD12 RET_VAL :=MW14 L MW 14 T DBW [MD 4]

Share this post


Link to post
Share on other sites
Hi Rod, Take at the look at the LOOP instruction: L 40 // load 40 cycles thru the loop _NXT: T MW10 // MW10 is the loop counter L P#0.0 T MD 0 L P# 160.0 T MD 4 L DBD [MD 0] T MD 12 Call FC 40 IN :=MD12 RET_VAL :=MW14 L MW 14 T DBW [MD 4] L MD 0 // step 1 word forward L L#16 +D T MD 0 L MD 4 // step 1 word forward L L#16 +D T MD 4 L MW10 // load the loop counter LOOP: _NXT // decrement loop counter and jump back to _NXT Edited by JesperMP

Share this post


Link to post
Share on other sites
Thanks for your reply. Iwill give it a try.

Share this post


Link to post
Share on other sites
I just notice that despite you said that the data is in S5T format (size = 1 word), you are passing the value at one step to MD12. 1st I dont get why you dont pass it to a word. 2nd there is possibly a problem with MD12 overlapping with MW14 (MD12 = MW12 + MW14). Maybe it is not a problem because later the RETVAL writes to MW14, but it definitely confuses everything. If I were you I would tidy it up so there are no overlapping adresses.

Share this post


Link to post
Share on other sites
I did end up change the above mentioned addresses in the final program. Thanks for your assistance

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0