LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How can i write the floats value in Unitronics vision230 plc using modbus Ethernet

Solved!
Go to solution

       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.

0 Kudos
Message 1 of 5
(4,934 Views)

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

 

0 Kudos
Message 2 of 5
(4,922 Views)

 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

Message Edited by Artemistech on 01-30-2009 11:06 PM
0 Kudos
Message 3 of 5
(4,915 Views)
Solution
Accepted by topic author Artemistech

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

0 Kudos
Message 4 of 5
(4,909 Views)
 Thanks Amit , your logic has been work..............  maan gaye ustaad....
Message Edited by Artemistech on 01-31-2009 02:39 AM
0 Kudos
Message 5 of 5
(4,903 Views)