LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

type casting fixed point on a cRIO

I'm trying to typecast a fixed point value into a string as part of my code on a cRIO, and it's actually not working correctly.

It works correctly on my laptop, but when I run it on the cRIO, it converts it into empty data of the same size. 

 

The string is part of the typedef I'm using for data transmission in a CAN emulation.  The reason it's not the fixed point in the first place is because it must hold different datatypes in different situations.  Thinking to keep it as similar to the actual CAN as possible, I chose string over variant because, in CAN, messages are transmitted as a byte array.

 

 

Anyways, I've tried two different methods of converting it to and from a string, and they both end with the result of the constant wired to the "data type" terminal.  (I named my cRIO "NeverWireLive") 

 

 

 So it looks like I may have to switch to using variants.  However, I'm still going to have to find a way around this problem for the actual CAN software.  The CAN spec for our motor controllers uses fixed point numbers in many cases.

 

 

 

I've attached images of what my example, but I figured it was simple enough that having the original VI wouldn't be of much use. 

Marshal Horn
Download All
0 Kudos
Message 1 of 4
(2,890 Views)
As far as I know there should be no problems with either of these functions on Real-Time.  Since you are doing fixed point, are you sure that you are converting back the same fixed point encoding type?  By this I mean same word length, integer word lenth, signed vs unsigned, etc.  Do these functions work properly if you use an int or double data type?  What version of LabVIEW and LabVIEW Real-Time are you using?
0 Kudos
Message 2 of 4
(2,862 Views)

Yes, type-casting integers and floats works fine.

In my example I forgot to check the datatype on the constants, so the "flatten to string" wasn't working either.

However, I corrected the datatype.

So it's just the type cast that isn't working.

 

What is the difference between those two functions? 

Marshal Horn
0 Kudos
Message 3 of 4
(2,857 Views)
Type Cast and Flatten To String are essentially the same thing.  However with Type Cast you can cast to any data type, and FTS you can only go to string (obviously).  Also with FTS, there are a few other options such as prepend array or string size, byte order and error handling.  Did you use either of these inputs for your functional FTS function?  They should be working the same, I don't know why they would be giving different data.  What version of LabVIEW and what cRIO are you using?
0 Kudos
Message 4 of 4
(2,843 Views)