How to change type data word to float?

I have successfully connected Mitsubishi PLC type Q to GX Work 2 and to node red using MC Read, the problem is that the output of MC Read for the feed address and speed is word data type, while for temperature the data type is float, I have tried to convert word to float using node funtion and also parser but it doesn't work, can anyone provide a solution?

I think maybe you should show us the output of MC Read, then perhaps we can suggest a solution.

Maybe this flow could help you.

this is the flow, for parses even though it has been connected it is still an error

Read the MC Read nodes built in help. It tells you how to return float values.

Example DFLOAT100 will request D100 as a float.

thanks this way works, well it works for address D12277, but how come it doesn't work on D12266, on D12266 the value is even 0

Perhaps D12266 & D12267 are zero in the PLC?

Perhaps they are zeroed by another function before the end of the scan?

Try reading 2 WORD values from D12266 DWORD12266,2

Btw, the reason you're original attempt does not work is you only read 1 16bit value from the PLC. A float is 32bit (2 WORDS)

and the parser shows an error because that is the last thing it encountered.

The value is that, but in HMI it is 184.7

Which value is what? Do the actual read from the PLC and show us the output in node-red as requested:

Additionally, pull the value up in GX and show us that too.

Does the HMI read the address you you are queuing? Does the HMI do any internal conversion? What address and format does the HMI specify?

in GX even the value does not come out when the PLC is running.
This is from the beginning anyway, why do you think the GX work does not bring up the number when the engine is running?

and this is the result of using DWORD12266,2 di debug 5

You cannot rely on the view of a single function in the PLC. The value of a data memory can be updated many times throughout the scan of the PLC ladder. Usually it is the last operation that matters.

You need to view the whole data memory area (batch view or watch the 2 addresses)

Now you CAN feed the array of 2 values into a buffer parser but in reality you should cross reference the PLC to see what the final expected value is for that address. For example, it may be the intention of the ladder designer that the final result of this address is a float or a UINT that should be divided by 10 or some other variation

then what should I do so that D12266 can turn into a float ? sorry I'm really a beginner.

You really need to understand the original intention. Is the value REALLY a float?

Just because someone has presented a value on a HMI that looks like a float does not mean it is an IEEE754 float. It could be an integer multiplied by 1000. It could be a made up format. It could be ASCII characters.

If you don't have access to the HMI source to trace where the value comes from and what format is specified, you could interrogate the ladder to infer the intention.

As a last resort, feed the 2 values into a parser and try different options like floatLE, floatBE, uint32LE, uint32BE, with & without swap16/ swap32 etc until you see a value similar to what you expect.

1 Like

Thanks, I'll try it tomorrow when I work

This one I don't understand, but information from HMI, here is the type of data for D12266

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.