01-29-2007 03:38 PM
@marc A wrote:
Somehow I think we might see some more caps lock abuse, though :)
Let's hope not. My ears hurt a little.
BTW, it's nice to see that other people find the combined FP-BD functionality of the code capture tool useful as well.
01-29-2007 03:47 PM
01-29-2007 04:18 PM - edited 01-29-2007 04:18 PM
Message Edited by Ravens Fan on 01-29-2007 05:19 PM
01-29-2007 05:39 PM - edited 01-29-2007 05:39 PM
@RickH wrote:
Attached is another example. This is my VI that makes my calculations and convert them into a two byte hex. I NEED TO KNOW HOW TO CONVERT THIS INTO NON_PRINTABLE ASCII.
OK, your VI does NOT covert anything into two byte HEX, it creates a formatted string containing two characters (00..FF). Two such characters represent exaclty one byte, so if you want to retain the information contained in two bytes, you would need four digits. (0000...FFFF). That's not waht you want apparently.
You start out with a DBL and do a lot of scaling. For sake of argument, let's assume that your final DBL is in the range of a 2 Byte unsigned integer (0...65536). All you need to do is convert it to a U16 datatype, then typecast it to a string (This would give you Big endian, If you need little endian, reverse the 2byte string).
Look at the attached image. All clear? (To see the non-printable characters, set the string display to hex. This won't change the underlying data). 🙂
Message Edited by altenbach on 01-29-2007 03:40 PM
01-29-2007 05:55 PM
Altenbach,
Yes indeed. The VI I shared is a program that takes 3 polynomials used for a polyfit and truncates them so that the results can be placed into a 16bit register. The code mimics the function in a spreadsheet. I'm currently playing with your example as it appears a bit more elegant. Thanks!
Rick H.
01-29-2007 06:36 PM
01-29-2007 09:41 PM
Altenbach,
Thanks for the caveat, but the 16 bit conversion is a requiremnent, because the floating point is truncated when placed into the 16 bit register. In this fashion, the truncated value is representative to the actual value used for the calibration and calculation.
Thanks,
Rick H
01-30-2007 10:57 AM
Sorry, I don't think I ever suggested to skip any 16 bit conversion. Read my post again. Please let me know if anything was not clear.
@RickH wrote:
AltenbachThanks for the caveat, but the 16 bit conversion is a requiremnent, because the floating point is truncated when placed into the 16 bit register. In this fashion, the truncated value is representative to the actual value used for the calibration and calculation.
01-30-2007 11:28 AM
01-30-2007 12:08 PM