Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Labview communicating Modbus device

Solved!
Go to solution
Hey Centerbolt,

sorry, I tried to find signed conversion in numeric, but there wasn't any such option in numeric, thats why I endup with math calculations...
I am using base development package, do I have to install Labview or any other option.....please let me know

thanks for reply,

Cube



Message Edited by cube404 on 07-14-2008 09:19 AM
0 Kudos
Message 11 of 20
(3,067 Views)

cube404,

I have to admit I don't know much about the base package.  I would hope the something as simple as a numeric conversion would be in all packages.

0 Kudos
Message 12 of 20
(3,055 Views)
Hi Cube,

You can find it by going to right-clicking on your block diagram to go to your Functions palette. From there go to Numeric >> Conversion. Here you will find the different numeric conversions.

Alternatively, you can also bring up your Functions palette and click on Search on the top right hand of the palette. From there, search for "signed integer" (without quotes) and you will be able to choose the appropriate conversion VIs.

Let us know how that goes!
Rasheel
0 Kudos
Message 13 of 20
(3,046 Views)
Thanks for the replies. I did already try to convert it to a signed integer and that will not work because the number coming through from modbus is a negative number in the range of 0-30000 and hence the labview view Vi's will recieve the modbus data as a U16 so I'm reading in 65535 (max value for U16) and hence using the conversion functions is a wash because its converting 65535(unsigned to 65535 signed).
 
It seems like I need versions of the modbus labview vi's that already do the conversion for signed integers.
 
Thanks again to all of you for your repies and any help or insignt will be greatly appreciated.
0 Kudos
Message 14 of 20
(3,040 Views)

Unsigned U16 has a data range of 0 - 65535.  Signed I16 has a range of –32,768 to 32,767.

Done correctly, unsigned integer ( U16 )  = 65535 converts to a signed integer ( I16 ) = -1.  Both of these numbers are represented by a binary 1111111111111111.  The only difference between signed and unsigned is how the binary number is interpreted.   If it is a signed integer and the most significant bit is a one, then you know you are dealing with a negative number.  To get the value of that negative number you must perform a two's compliment.  The NI function does all this automatically.



Message Edited by centerbolt on 07-14-2008 02:56 PM
0 Kudos
Message 15 of 20
(3,036 Views)

Thanks centerbolt and everyone else that chipped in...

That did work for me and I believe the I16 will be big enough to handle the data I'm expecting. I was converting the data to a I32 because the data registers being written to are the signed 32-bit registers. I definitely didn't have the added time to re-write the drivers to read it in as I32 instead of the U8 array and then decode and type cast it to a I16 as the modbus receive drivers are doing.

 

0 Kudos
Message 16 of 20
(3,028 Views)
Hey centerbolt,

Now I understood with ur picture and explanation what to do....I changed my math script to I16 and it worked perfectly...

thankx

Cube




Message Edited by cube404 on 07-16-2008 03:38 PM
0 Kudos
Message 17 of 20
(2,995 Views)
Hello Rasheel,

Its funny me, it was like I am standing in front of person with two names.........in labview its word integer as signed integer...its ok now

thanks for reply

Cube


Message Edited by cube404 on 07-16-2008 03:55 PM
0 Kudos
Message 18 of 20
(2,993 Views)

Hello!Can you  contact me?250332583@qq.com,I have some questions to ask you ,thanks!

0 Kudos
Message 19 of 20
(2,318 Views)
Hey my dear, What can I help? Thanks
0 Kudos
Message 20 of 20
(2,313 Views)