01-30-2009 03:30 AM
How can i write the Float value in unitronics Vision230 PLC usinsg modbus ethernet (MB Ethernet Master Query.vi) I read and write the 32 bit register, for e.g i want to write the 23.45 value on 2nd add. of MF. And MF register is 32 bit register. I read and write the 32 bit register.
Narendra.
Solved! Go to Solution.
01-30-2009 10:08 AM
Narendra,
I can help you with the generic way of doing this. You will need to refer to the manual of your specific PLC for more information. If you only have 32 bits then you can only use the Single type of float as that needs only 32 bits for storage( Doubles require 8 bytes). The best way to do this is to flatten the single float to a string. You will get 4 characters.Split them into two characters and write each set one at a time (16 bits) in consecutive registers making up the 32 bit you are looking at.
Amit
01-30-2009 11:04 PM - edited 01-30-2009 11:06 PM
Thanks Amit for your solution but i can not use the string to write the value because MB Ethernet master Query.vi only accepet the integer value its not take string values or any other i.e floats values etc.....otherwise i have no problem to write or read the 32 bit register values , only problem is that the MB Ethernet master Query.vi only accept the integer value there4 how can write the float value.
Narendra
01-30-2009
11:46 PM
- last edited on
04-17-2025
03:00 PM
by
Content Cleaner
Narendra,
Two characters can type cast into a uint16 which your the VI supports.
To summarize. Take a single (4 bytes). Flatten it to a string (4 bytes) Split this string into two parts of 2 bytes each. Typecast these into u16 (16x2=32 bits).
However, if you really want to follow the IEEE standards then you will need to refer to this KB. Its isn't as straight forward but sounds closer to what you are looking for.
Amit
01-31-2009 02:38 AM - edited 01-31-2009 02:39 AM