01-16-2013 02:35 AM - edited 01-16-2013 02:39 AM
Hello,
I want to set one floating value in modbus register located on 400.but I am not able to do so its only accept real number.
Will you please guide me what should I do in order to solve this problem??
I tried with suggestion which is given in link but still I am not able to connect the output to the modbus which I have mark red in attachment.
http://digital.ni.com/public.nsf/allkb/AD8172B710AFB13F86257974007D6F52
Actually I want to set my actual current value same as measured value that's why I need to do this operation.
Thank you very much in advance.
01-16-2013 06:50 AM
It is impossible to debug an image. Attach an actual VI instead. An image doesn't show the representation of your constants, or how many elements are in that array.
Why is your floating point indicator set to extended precision? It is very unusual to have a value with that much precision in a modbus application. Modbus generally doesn't even use double precision. The registers are usually only single precision and would use two U16 registers so that the 4 bytes would be single precisiobn.
If you have a single precision floating point number, then you should typecast that into a U16 integer array (that would then be 2 elements) and pass it to the modbus Write.
01-18-2013 12:22 AM
The best way what i found is multiply the number by 100 if after decimal 2 digit precision is OK with you other wise 1000 if 3. digit precision. Then write to register.
Later when reading read & divide by 100 or 1000 whatever
01-18-2013 10:10 AM
@Ranjeet_Singh wrote:
The best way what i found is multiply the number by 100 if after decimal 2 digit precision is OK with you other wise 1000 if 3. digit precision. Then write to register.
Later when reading read & divide by 100 or 1000 whatever
In the modbus units I've used, that could certainly result in major problems. The ones I've used, require the type casting as RavensFan mentions. Your method would write a number to a register but it would be an incorrect number. Look at the documentation of your modbus device.