LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

TI floating point

I am collecting data from a device that delivers the numbers in TI floating point format. Needless to say, I need to convert this into something I can use.

I’m using Labview 6.1 for this task and when collecting the data (from the serial port) I get hexadecimal numbers, like these;

92AF7626 3A4BC0FD 24CE35FF 424D0EA7 B0FE3839 216562D3 401AF016 784108E0 1A80470 CAC991A D213E1C 1429472A 5E011938 49720074 30A21041 F42457B 744C4A72 5200DE3 46E0BA30 31E24128 404C7A37 8000D04A A001F282 7012F828 60415320 C8102100 598E02E8 A9A4991C 2D500C20 97848C2 1A810092 4B20496 84B0110

These numbers represent positional data and should look like this;

00159A -0.2397
00159C -0.1731
00159E 0.1199
0015A0 -0.0533
0015A2 0.0000
0015A4 0.0799
0015A6 0.1332
0015A8 0.1998
0015AA 0.2530
0015AC 0.3063
0015AE 0.3596
0015B0 0.4261
0015B2 0.4794
0015B4 0.5194

The first column is simply an index and the second column is the positional data.
I am leveraging a C program that performs this conversion, however the portion of the program that does the actual conversion is written in assembly language and I am not at all familiar with assembly language. Here is that code snippet.

float cvt(float x)
{
_asm{
mov ax,word ptr x+2
xor ax,8000h
jz finis
mov bx,ax
dec bh
rcl bl,1
jnc finis
negno: not ax
neg word ptr x
adc ax,-1
stc
finis: rcr bx,1
and bx,0ff80h
and ax,07fh
or ax,bx
mov word ptr x+2,ax
}
return x;

}

If anyone can explain to me what’s actually going on here, and how I might do this in Labview, it would be GREATLY appreciated.

Kirkland Smith
KirklandSmith@cox.net
0 Kudos
Message 1 of 3
(2,832 Views)

Hello,

If the C function that you have is known to work with the TI floating point datatype, the most easier way to interface this function with LabVIEW will be to create a DLL that can be called by LabVIEW, or use the Code Interface node to call the code directly.

The following documents may be useful for using this C code in LabVIEW.

How to Build a DLL with Visual C++

An Overview of Accessing DLLs or Shared Libraries from LabVIEW


Scott Y
NI

0 Kudos
Message 2 of 3
(2,804 Views)
Thanks for the info, I'll definitely give that a try tonight. That program was designed to work in DOS and I'll be (of course) working in windows (labview). Hopefully I'll be able to make it happen. If anyone knows assembly language though, and can tell me what that actually DOES, that would make a world of difference.

thanks

Kirkland Smith
0 Kudos
Message 3 of 3
(2,798 Views)