parts223

Assign Numbers To Devices Dynamicaly

4 posts in this topic

Is there a way to assign a number to a device dynamically, for example

There is saved data in ZR200-ZR399, ZR400-ZR599, ZR600-ZR799

I need to move this Data To ZR0-ZR199 depending on the program number the user selects

If I did this in a GOT script it would look like this,

bmov([w:ZR0[w:GD50],[w:ZR0],200);

This would move a block of 200 from ZR200-ZR399 to ZR0-ZR199 provided GD50 was equal to 200.

If GD50 is equal to 400 then this would move ZR400-ZR599 to ZR0-ZR199.

 I am trying to do this within the Q series PLC  program and not with a GOT script. Is there an easy way that I am missing?

Thanks,

Rob

Share this post


Link to post
Share on other sites

BMOV

1 person likes this

Share this post


Link to post
Share on other sites

Indirect addressing, Z is an index register. I use those for things like that. 

So D0Z0;  if Z0 holds a value of 5 than D0Z0=D5 

So if Z0=5 and you said [MOV K1 D0Z0] then you would be moving a 1 into D5.

For your application you could [BMOV ZR0 ZR0Z0 K200] Then control the value in Z0 to point to the registers you want. So Z is your GD50..kinda.  

1 person likes this

Share this post


Link to post
Share on other sites

MItsm83,  thanks that is exactly what I was looking for.

 

 

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