How to get the fraction or floating point in WLSOFT Delta PLC

HamzaAhmed

Member
Join Date
Aug 2020
Location
Palestine
Posts
86
Hello guys,

i am taking a value from load cell module, i have to scale it so i want to divide it by 100 but the Wlsoft doesn't give me the reminder or floating point and it is necessary to get it value.

what i supposed to do?

thanks,
 
I assume you are retrievng an integer value from the load cell?

If so, perhaps you can copy, or move, the integer value to a floating point value, and then divide the floating point value but 100.0, or multiply by 0.01.
 
I assume you are retrievng an integer value from the load cell?

If so, perhaps you can copy, or move, the integer value to a floating point value, and then divide the floating point value but 100.0, or multiply by 0.01.

Yes, i converted it to floating number for example i get the value 1005 from the load cell the i converted it to 1005.00 then divided it by 100 so the floating number is 10.05 but when i use the register which have the floating number it shows different huge number 161351615 .

why if this happened?
 
Can you put the result of 1005.00 (float) by 100.0 back into the place that was 1005.00, i.e. to where you converted the integer 1005?
 
I'm not too ofay with CLX but can't you convert the float to an integer this should get rid of the decimal place, however, I am unsure what you are trying to achieve. The register you are using as the result of a float divide takes up two 16 bit registers so if you try to use it as an integer then it will read a high number See pic below
Here i have divided the real number by 100
Converted it to an integer
divided the original integer by 10
Got the remainder from a divide as an integer
and the last rung is where I have done an integer divide on the original float you will notice that the number is huge so you cannot use a float as an integer.
A float uses a 32 bit register so in this case %MW 0 to 1 is the float (MW0 and MW1) if you use %MW0 in an integer calculation then the number is not valid.
I am assuming in your system it allows you to do this, in the example of Mitsubishi although you can use the actual addresses you cannot use the tag name or it will not compile.
So to sum up you cannot use a real (float) tag in an integer calculation.
In your case you divide 1005.00 by 100 so you loose the .5 if you convert it to an integer, you can get the remainder as shown but if you cannot use the decimal point in what ever you want to do with the code then you have to ignore it. or use all floating point maths.

Float to int.png
 
I'm not too ofay with CLX but can't you convert the float to an integer this should get rid of the decimal place, however, I am unsure what you are trying to achieve. The register you are using as the result of a float divide takes up two 16 bit registers so if you try to use it as an integer then it will read a high number See pic below
Here i have divided the real number by 100
Converted it to an integer
divided the original integer by 10
Got the remainder from a divide as an integer
and the last rung is where I have done an integer divide on the original float you will notice that the number is huge so you cannot use a float as an integer.
A float uses a 32 bit register so in this case %MW 0 to 1 is the float (MW0 and MW1) if you use %MW0 in an integer calculation then the number is not valid.
I am assuming in your system it allows you to do this, in the example of Mitsubishi although you can use the actual addresses you cannot use the tag name or it will not compile.
So to sum up you cannot use a real (float) tag in an integer calculation.
In your case you divide 1005.00 by 100 so you loose the .5 if you convert it to an integer, you can get the remainder as shown but if you cannot use the decimal point in what ever you want to do with the code then you have to ignore it. or use all floating point maths.

Thanks for your replaying, it was very good.
I am using WLSOFT the MOD instruction is not exist.

But i found the solution by accident when i divided the number in register 1 the result for example will be stored as integer value in D2 and the MOD or floating value will stored automatically in D3 so you can use it easily.

Thanks guys.
 

Similar Topics

Hi, how do i include the fractional part of the position I set for encoder? I have an Omron PLC and using cx programmer. I need to command my...
Replies
16
Views
3,896
Hi, All I have received the task of measuring a process down to a 1/64 of an inch. No problem with the laser's range and mA value...
Replies
19
Views
5,839
I have a flowmeter that provides 4-20 output for flow rate and also has an "odometer" for flow total. There is also a pulse output from this...
Replies
2
Views
1,871
Hello! I am simply trying to convert a distance in inches to feet showing the number of feet with the fractional part just displayed as .xxx. I...
Replies
2
Views
2,618
How is floating web accumulator works ? I have a project where I will control a floating accumulator without speed trim. Input and Output rolls...
Replies
14
Views
3,480
Back
Top Bottom