Jump to content

Index register don't work with float or dword variable


Recommended Posts

Posted (edited)

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
Posted

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

  • Like 1
Posted

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.

Posted (edited)

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
  • Like 1
Posted (edited)

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
  • Like 1
Posted

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. :))

Posted

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.

 

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...