From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

4-Byte IEEE floating number conversion

Hello guys :

 

I've faced a probelm on converting the 4-byte IEEE binaries into floating numbers.

 

I've got the 4-byte binary data from spectrum analyzer SR780 capture buffer.

 

Fig1 Block diagram of  VI "Upload Capture Buffer"

未命名4.png.

The description of "CGET" command in the user mannual of SR780

未命名5.png

The captured data is 100mV 10Hz sine signal. The whole capture length is about 5 seconds.

 

While I've faced a probelm while I convert the 4-byte IEEE floating number into floating numbers.

 

Fig2 Block diagram of  my VI, try to convert 4-Byte binary to floating number

未命名2.png

The main conversion process is learned from the block diagram of another sub VI "Query display data"

(this is one of  the SR780 GPIB driver sub VI) through GPIB interface.

 

Fig3 Block diagram of  VI "Query display data"

未命名3.png

Actually I can already see the periodic behavior of the obtained binary data. The period is 10Hz, too. However I cannot get correct waveform.

 

Fig4 the periodicity of the binary numbers

未命名.png

 

 

 

 

 

 

 

 

 

 

 

I just cannot figure out why I follow the same process while I get the wrong result?

 

The attachments are the binary data files, the string interpretation of them and my VI try to figure it out.

 

I'll appreciate If anyone give any suggestion. 

 

Thank you!

0 Kudos
Message 1 of 4
(3,979 Views)

Interesting that they are type casting 4 bytes into a Double, which is actually 8 bytes.  You are type casting to a Single.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 2 of 4
(3,969 Views)

Hey,  crossrulz:

 

Thank you so  much for your reply.

 

I notice this. However it makes no difference whether I change the converting result as Single or Double.

0 Kudos
Message 3 of 4
(3,952 Views)

Hi,

I realized it was 4 years ago but did you manage to get a proper output from the capture buffer?

I'm facing the same problem.

Thanks

Naama

0 Kudos
Message 4 of 4
(1,631 Views)