01-08-2019 05:52 AM
Hi there,
I want to convert a negative single to unsigned 16 bit integer. When I have a 0 in single data type, after the conversion I would like to have 32768 in unsigned 16bit integer datatype. Any suggestions?
PD.: When I try to convert a negative value of single I obtain a zero on the output.
Thank you.
Solved! Go to Solution.
01-08-2019 06:51 AM
01-08-2019 08:15 AM
Hi Gerd,
Thank you! Yes that's it. Now I have another problem. In my application I'm communicating a siemens s7-1200 with a cRIO 9039. I'm using modbus TCP to write in the holding registers of the PLC, but the value I'm sending is not the one that it's being written in the holding registers. The PLC works with int datatype(signed 16 bit integer), but the functions reading/writing in labview work with unsigned 16 bit dataype.
Somehow I've managed to read the data of the PLC without problems, but writing it's a different thing. You can see the function I'm using with the values I'm writing on the attached image "writing". Also, I've attached the values in the PLC, as you see are different to the ones in labview.
Thank you in advance.
Best regards,
Iñigo.
01-08-2019 08:21 AM
Hi Inigo,
when you need I16 values you should work with I16 data in LabVIEW!
An U16 value of 33568 is the same (bitwise) as the I16 value of -31968!
So get rid of the conversion I suggested in my previous message and simple convert the SGL value into an I16 value. Wire this I16 value to your MODBus functions…
01-08-2019 08:29 AM
Hello Gerd,
But the function accepts U16 as an input, if I do what you're suggesting, a coertion dot will convert the data to U16, won't it?
Best regards,
Iñigo.
01-08-2019 08:37 AM
01-08-2019 09:56 AM
Hello Gerd,
Your solution is working. I thought that I would have the same problem, because of the coertion dot. This is not the case, my bad.
Thank you bery much.
Best regards,
Iñigo.
08-29-2019 04:10 AM
08-29-2019 04:24 AM
Hi Saisravan,
Can u plz explain this one .I'm also facing same problem ..
Which problem do you face? Who are you talking to?
(And what is "u" and "plz"?)
08-29-2019 04:50 AM