LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

data conversion

Solved!
Go to solution

Hallo I have a Contollogix PLC connect to cRIO 9073 by Ethernet , I configured the PLC to send e recive real data format.

I received data in the right way but when i send data to crio I read the data in the wrong way.

I'm using the labview ethernet library , the only data format supported by it is U8 8 bit integer.

Any one has experience whit this kind of application?

Tks a lot

0 Kudos
Message 1 of 10
(3,449 Views)

hi bsmauto,

 Please try to use to the typecast vi to convert data to float.

 

 

Thanks and regards,

srikrishnaNF

Regards,
Srikrishna


0 Kudos
Message 2 of 10
(3,426 Views)

I tried to use typecast VI but unsuccessfully.

I obtain a number that no match the value write from PLC.

If the PLC write 2 I have 8,96831E-44 using type cast

Attached PDF document just to better understand what happen between LW and the PLC.

Tks so much

0 Kudos
Message 3 of 10
(3,412 Views)

I could be due to different endian format.

Toy around with this function, you can use the string to byte array function to get the data in a U8 byte array

 

Flatten To String Function
Owning Palette: Data Manipulation Functions

Installed With: Base Package

Converts the anything input to a flattened data string of binary values. You also can use this function to convert the byte order, or endian format, of the data in the flattened data string.



Besides which, my opinion is that Express VIs Carthage must be destroyed deleted
(Sorry no Labview "brag list" so far)
Message 4 of 10
(3,395 Views)
My data are already in U8 format , in the document the problem focus is describe!!
0 Kudos
Message 5 of 10
(3,384 Views)

Coq Rouge's answer is correct.  It is endianism.  You need to reverse the array when using typecast.

 

 

Message Edited by Ravens Fan on 06-06-2010 10:02 PM
0 Kudos
Message 6 of 10
(3,368 Views)
Solution
Accepted by topic author bsmauto

bsmauto wrote:
My data are already in U8 format , in the document the problem focus is describe!!

 

Then programming it is important to have attention for details ;). Computers and software may store number in different endian format. Google endianess for more info. LabVIEW uses Big Endian format for its binary numbers (same as Unix and MAC), while most Windows programs use Little Endian format.

I have included a demo for you. Try to send little endian input to big endian input and see what happened



Besides which, my opinion is that Express VIs Carthage must be destroyed deleted
(Sorry no Labview "brag list" so far)
0 Kudos
Message 7 of 10
(3,328 Views)

Tks a lot to all for suggestion and clarify.

We got it!!!

0 Kudos
Message 8 of 10
(3,303 Views)
Then please mark Coq Rouge's message as the solution to your problem rather than your own thank you message.  If you go to the options menu to the upper right of your message, you will be able to unmark yours as the solution so that you can mark the message that is the actual solution.
0 Kudos
Message 9 of 10
(3,291 Views)

That's great. Can you then please mark the response which was the actual solution rather than your comment? You can unmark a solution using the Options menu that appears in the message's title bar all the way to the right.

 

 

EDIT: What Ravens Fan said.

Message Edited by smercurio_fc on 06-07-2010 04:25 PM
0 Kudos
Message 10 of 10
(3,290 Views)