Simo99

Unknown operations

8 posts in this topic

Hello everyone,

I have a problem with these instructions, I don't know how "D750Z0" is 528.

Could you please help me?

One more thing, could you give me a clear example of how the instruction "SFL" works please?

Because I don't know how it works, thank you very much.62deb03ef3d29_Immagine2022-07-25171511.t

Edited by Simo99

Share this post


Link to post
Share on other sites

Hello Simo99,

SFL is the instruction for shifting (moving) bits to the left.  Each time the instruction is executed, it moves the bits in (d) by (n) bits.  I would recommend reviewing the e-Manual Viewer's help file on SFL(P).  Depending on which model of PLC you're working with, you will probably want to monitor the Carry bit in SM700 or SM8022.

I write up a quick demo for you.  The ladder loads '59' into D1000 and then shifts it to the left by 3 bits each time SFL is executed.

I'm not an expert with SFL but I hope this helps.

 

SFL demo.png

Share this post


Link to post
Share on other sites

Thank you very much for your explanation, but I still cannot understand why D750Z0 comes out as 528.
Can someone please explain it to me?

Share this post


Link to post
Share on other sites
1 hour ago, Simo99 said:

Thank you very much for your explanation, but I still cannot understand why D750Z0 comes out as 528.
Can someone please explain it to me?

D750 is device Z0 is used as offset.... if you have, lets say, 10 stored in Z0, it will use value stored in D760 (750+10)

Share this post


Link to post
Share on other sites

hi simo99,

I think you are observing the wrong data register, because the index register Z0 is written with a new value.
The displayed value should come from register D753 (D750Z0, Z0=3) as shown in the screenshot.

At the time of the calculation, however, Z0 should have the value 8 ((138-1)/16)=8 and the result of the last WOR instruction should therefore be in D758.

I assume that Z0 is written at another place with the value 3 and the displayed actual value does not show the result of the calculation but the content of the data register D753.

The result of the calculation should be in D758, have the registers D750- D758 displayed (watch list).
 

For me the calculation is as follows:

[- D448 K1 D700] (D700= 137)
[/ D700 K16 D704] (D704= 8, D705=9 (remainder)
[MOV D704 Z0] (Z0= 8)
[MOV K1 D708] (D708= 1)
[SFL D708 D705] (D708= 1024) shift n=9
[WOR D708 D758] (Z0=8, D750Z0= D758)

 

Share this post


Link to post
Share on other sites

Yeah if a pointer is calculated/used in more that one place then monitoring is bascially useless for the pointer & the registers its pointing. 

there are 20 Z available but it seems everyone only uses Z0.  lol.  I will share a Z only if the functions are related & exclusive i.e. reading & writing from a array. Where only 1 option is ON at a time. 

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