LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Valid type declarations within a formula node

What are the valid types allowed in a formula node. Specifically, can unsigned types be declared?

For example, assume you have hooked a control with type unsigned byte to the formula node labeled "x". For the output you connect an indicator with type unsigned word (16 bits). Inside you have the code:


/* formula node */
int16 y; /* defines output */


y = x;
/* end of formula code */


Let the input be 255. When the VI is run, the output will be 65535! This is because when the expression "y=x;" is executed, the byte value 255 is sign extended upon assignment to the int16 output "y".


Of course the assignment could be rewritten as:


y=x & 255;


so the output will be 255 as expect
ed.


The problem is that this is a little sloppy. It would be far superior if instead of defining "y" as "int16", it could be defined unsigned such as "uint16" (this doesn't work -- I tried).


The types you can declare inside a formula node (that I know of) are:


int8
int16
int32 (or int)
float32
float64 (or float)


The question is are there any other types available?


Thanks for your input


David Walker
0 Kudos
Message 1 of 2
(3,309 Views)
David,

The available types are

int8, uInt8, int16, uInt16 int32, uInt32,
float, float32, float64

Hope this helps.

Marcus Monroe
Application Engineer
National Instruments
Message 2 of 2
(3,309 Views)