NgoHoang

Pointer In GX-Work2

9 posts in this topic

Dear all!

Last time,I never use Pointer type in GX-Work2. I use ST languge.

I define a variable in picture below.

Can you help me:

    - I want to move a value to P100 (P100 is a Pointer).

    - If M0 is TRUE, D memory = P100 will be set K100.

 I search something in Internet but can not see. Any doucument about pointer in PLC Mitsubishi (ST), please send it to me.

Thanks and best regard

Pointer.png

Share this post


Link to post
Share on other sites

Not sure what you want to accomplish since P100 is a pointer (as you also say yourself). No matter if you use Ladder or ST, pointers are used for referencing other program parts, and sequence control, not to contain "values". What is it you want to do?

Share this post


Link to post
Share on other sites

You need to use data registers (D) not pointers (P).  Pointers are to jump to different parts of a program.  They don't store data.

Share this post


Link to post
Share on other sites

If you are hoping to use it like an index pointer those are Z.  

MOV K10 Z1

MOV D0Z1 D1000   :: Will move D0(+10)=D10 > D1000

Share this post


Link to post
Share on other sites

Thanks all!

My mean is same with WattUp. Sorry because I describe not clearly!

Last time, I want o access D"a" memory. But "a" = Dxxx + 100.

Now I understanded. Z is Dxxx. Index pointer Z is correct!

Thank you so much!

Edited by NgoHoang

Share this post


Link to post
Share on other sites

If you don't want to use devices like Z create an Array variable then you can use ArrayName[pointer] 

1 person likes this

Share this post


Link to post
Share on other sites

Thank for your reply!

We can use D0Z0 := K100 but if D0 is named is Data, we can not use "DataZ0". Any more ideas about it?

Thanks and best regrard!

Share this post


Link to post
Share on other sites

As in my previous post create an array called Arrayname[pointer]

In your case DATA[Z0] or DATA[labelname]

Here is an example Array.gxw

Edited by Gambit

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