# Double Word to ML

## Recommended Posts

Hi,

I am new to PLC programming, I need to divide a double word (DW) in two ML, because we are programming a remote acess and the program only accept ML not DW.

Anyone Know how can i do that?

My PLC is V570.

Thanks,

Guilherme

##### Share on other sites

Hello,

A DW and an ML are both 32-bit integers.  The only difference is the DW is unsigned, and the ML is signed.  Therefore, you can just store the DW straight into an ML, as long as the value in the DW is not too large (i.e. over +2,147,483,648).

##### Share on other sites

Hello,

Thanks for the reply , but if my DW is more than +2,147,483,648 , I can divide it into two MLs ?

I am using that in a flow meter in high-speed input , so that the value in the DW is more than +2,147,483,648 .

I saw on the high-speed input I can use ML , so I have a doubt whether the value in ML is more than +2,147,483,648 that will rewrite  automaticaly or i need to do a reset on the ML?

This is my program:

##### Share on other sites

Hello,

I am unsure what you mean by "divide it into two MLs".  Are you trying to build a larger integer out of two MLs?  If so, it is not possible to create integers out of two other integers.

The range for a DW is 0 to +4,294,967,295.  The range for an ML is -2,147,483,648 to +2,147,483,647.  The largest number the controller can handle in an integer is 4,294,967,295.  Since you are working with pulses from a HSI, the pulses cannot be negative.  So there shouldn't really be a need to use MLs for the HSI.

Hope this helps.

##### Share on other sites

Typically if you overflow an integer data type it rolls over to it's maximum negative number and counts from there which can cause some pretty weird issues if you haven't accounted for it.

What is the goal of the high speed counter? What happens with the count when you're done with it, or when it reaches a setpoint?

## 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

×