GX Developer commands

Jhona

Member
Join Date
Oct 2016
Location
Morelos
Posts
11
Hello everyone!
Could someone help me and explain me this block of a ladder diagram I'm working with?

I do understand the M800 is always ON contact, for the PLC to not lose the values.
Also I know that the DIV is a division, the FLT is a integer to floating point (thing I don't understand), the DEMUL is a floating point multiplication (thing I also don't understand), the INT is a floating point to 16-bit integer, and the MOV is for moving a value from a data register to an other data register.

Help... :(

noseee.jpg
 
If what you have typed above regarding the instructions is correct, then:
1. Divide D1 by 10, and store the result in D20.
2. Convert D20 to a Floating Point value (instead of, presumably, an integer) and store it in D22
3. Multiply D22 by whatever value is stored in D240 and store the result in D26
4. Convert D26 from floating point data back to integer data, and store it in D28
5. Move the value of D28 to D8271

So, ultimately, you have a number in D1. You divide it by 10, multiply it by the value of D240, and store the answer in D8271.

If you don't understand what the conversion between floating point and integer is all about; the simplest way to think about it is that integers are whole numbers (1, 2, 3, 100, 7463, etc) while floating point can represent both whole numbers and decimal numbers (e.g. 1.0, 1.1, 1.0042, etc).

As to WHY it performs each step...

1. Because you want to divide the figure by 10. Note that when you divide an integer by 10, you won't get a decimal value back. So if D1 was 20, you'd get 2 in D20 after the first instruction. but if D1 was 24, you wouldn't get 2.4 in D20, you'd just get 2.

2. It would seem that D240 is a floating point value, so in order to multiply it by D20, which is an integer, you first need to convert it to floating point. You can't multiply an integer value by a floating point value in a Mitsubishi PLC; the data types have to be the same.

3. Now that you have converted D20 to a floating point value, you can multiply it by your other floating point value.

4. You need the answer as an integer, not a floating point, so convert it back. Note that you'll lose any decimal places here too. I can't tell you exactly how this type of PLC's handle the conversion; some truncate (just chop off decimal places, so whether the value is 2.001 or 2.999 it just becomes 2), some round (so 2.499 and below becomes 2, and 2.5 and above becomes 3), and some do all sorts of other creative things like rounding to the nearest even number. You'd have to test it on your PLC to be sure of the results.

5. Finally, put the result where you wanted it all along.

Does that help?
 
I would just add that floats are 32bit so to accomodate the FLT conversion of D20 is moved into D22 & D23. The DEMUL is a 32bit divide which is dividing the value in D22 & D23 by the value in D240 & D241 and storing it in D26 & D27. The INT conversion of D26 & D27 converts the value back to a 16bit 'whole number' and stores it in D28.

I hope this helps
Steve
 

Similar Topics

Hi, first time poster on here so please be easy! 🍻 I'm trying to do an increment or addition command in GX developer to add a data...
Replies
4
Views
3,157
Hi I am having to edit a PLC programme written for me by a developer who is not avaialble to edit it for me. I can do basic stuff and can edit...
Replies
7
Views
7,566
I'm trying to verify a project with a PLC. The Transfer Setup menu item is grayed out and every time I click Verify with PLC, I get an error...
Replies
1
Views
47
Well, I've decided to start a new project, and like all projects, it has already gone horribly wrong. I purchased a PLC device (supposedly a...
Replies
2
Views
111
Does anybody have any samples of how to "Create and Use" UDT's in CCW Developer Edition? (I am using v22) I can't find any information from...
Replies
3
Views
312
Back
Top Bottom