ducna

Index register don't work with float or dword variable

12 posts in this topic

Hi everyone,

Continue in the journey to conquer MELSOFT. 

I created a function block with some in/out. The In/Out has data type Word. I can assign the index as D0Z0, D1Z0...

But with In/Out having float or Dword data type, the program says the data is not suitable for variable.

What can I do in this case?

My fallback is to put it all back to the Word data type (that's stupid @@). 

Have a good day!

Edited by ducna

Share this post


Link to post
Share on other sites

If  the input output is defined as word than a word schould be connected.

But it you want to PLC to process as something else you need to use the INT2..... instructions

1 person likes this

Share this post


Link to post
Share on other sites

Hi @Gambit

Thanks for your reply.

I mean when I use D0Z0, the program automatically assigns the word data type on device D0.

But actually I want to use data type Float or DWORD on memory area D0. 

Is there a way to specify D0Z0 with float data type?

For example:

FB_Unit (variable1:= D0Z0);

Variable1 is input with floating point data type.

Then D0Z0 is not suitable with Variable1.

Share this post


Link to post
Share on other sites

You should not use D0 anyway, That is from the past.

Use variables instead of devices

Create an array instead. Zo can be  any defined word.

MyArr[Myponter]

 

 

Edited by Gambit
1 person likes this

Share this post


Link to post
Share on other sites

Hi @Gambit

Thats a great idea.

The problem has been resolved.

Thank you very much! 

Share this post


Link to post
Share on other sites

excellent :-2

Share this post


Link to post
Share on other sites

Hi @Gambit,

A little error in the working process. I cannot assign variable with Z0 in LADDER program.

Do you know any way?

Thank you.

Share this post


Link to post
Share on other sites

When using arrays you do not need to use Z0. This was only used when using direct devices like D100Z0.

Sorry for the late reply i was on holiday

 

Edited by Gambit
1 person likes this

Share this post


Link to post
Share on other sites

Hi @Gambit

Because I need to handle about 1000 I/O and meet the project schedule. So I need register Z0.

I noticed FX 3G CPU can't use array data type. I can't call tag in the statement. :))

Share this post


Link to post
Share on other sites

Z0 is not neccesarry when using lables 

Sure you can.  Are you using GX Works 2 structed type project ?

 

1 person likes this

Share this post


Link to post
Share on other sites

Hi @Gambit

Sorry for late reply.

I'm using GX works 2 simple project with use label.

I find it impossible to use the array data type in the ladder language. So I found a way to handle it gracefully with a ST language section.

 

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