09-23-2015 01:45 AM
Im having a little trouble making a labview VI for this process, where var1send and var2send are signed 16-bit integers
int8_t var1low = var1send & 0xff;
int8_t var1high = (var1send >> 8);
int8_t var2low = var2send & 0xff;
int8_t var2high = (var2send >> 8);
Any help would be awesome!
Solved! Go to Solution.
09-23-2015 02:17 AM
Hi sout,
does the "split number" VI do that for you? It splits a 16 bit number into two 8 bit numbers. You can find it under Programming >> Numeric >> Data Manipulation.
09-23-2015 02:32 AM
09-23-2015 04:06 AM
I think your right, thanks for the help. The split number function should work.
Just one other thing, is there a function to convert a decimal into a signed 16-bit integer?
09-23-2015 04:18 AM
Yes, there is.
BTW, there also is a ton of tutorials available online that help you with these things:
3 Hour Introduction
6 Hour Introduction
LabVEW Basics
Self Paced training for students
The Function you're looking for is called "To Word Integer"
Self Paced training beginner to advanced, SSP Required
LabVIEW Wiki on Training
Learning NI
Getting Started with NI Products
09-23-2015 04:38 AM
Sorry my mistake, i meant to say from a decimal to binary 16bit signed
09-23-2015 04:52 AM
Do you mean a boolean array of the Value? And number to boolean doesn't work?
09-23-2015 05:01 AM
Everything i try, doesnt seem to work.
Basically, I can't seem to figure out how to convert a signed 16 bit decimal number into a signed 16bit binary number and then split that
09-23-2015 05:16 AM
Decimal and Binary just two representations of the same number. Right click on the Element >> Visible Items >> Radix; then click on the radix and select.
Splitting should work as described above.
If you still have questions, please include an example, as it's hard to guess what does work, when we don't know what you already tried.
09-23-2015 05:41 AM
Ok, so this is basically what I want, i dont want to enter the number in as a binary number. Ive tried to use format into string to convert to binary, but I am not able to split the string into 2 seperate 8-bit bytes.
Not sure what other functions i can use to convert from decimal to binary except not in a string.