beautypg.com

Teledyne LeCroy X-STREAM OSCILLOSCOPES Remote Control User Manual

Page 304

background image

A

P P E N D I X

I I :

Waveform Template

298

ISSUED: February 2005

WM-RCM-E Rev D

HOW TO CONSTRUCT A FLOATING POINT NUMBER FROM FOUR BYTES

' Routine to construct a double precision floating point number from
eight bytes.

Function GetDoubleFloat (DescPoint as Integer)

' DescPoint is the address of the byte in the waveform descriptor
' where the data begin.
‘ The data are assumed to be in an array called Desc (0 to 350).

' For example, to calculate HORIZontal_OFFSET, DescPoint = 180.

' Constants needed by GetDoubleFloat
DMult2 = 1 / 16
DMult3 = DMult2 / 256

' Comm_Order is the variable which provides information
' about the order of the bytes in the descriptor and.
' in the waveform data. Comm_Order is the byte at position
' 34 in the descriptor.

' Set ByteOrd = 1 when Comm_Order = 0 for high byte first.
' Set ByteOrd = -1 when Comm_Order = 1 for low byte first.
' Set ByteOrd7 = 7 * Comm_Order.
' ______________________________________________________________

ByteOrd = 1 - 2 * Comm_Order
ByteOrd7 = 7 * Comm_Order

DMult3 = DMult2 / 256
' ______________________________________________________________

FByte = ByteOrd7 ' Sign started
FDigit = Desc(DescPoint + FByte)
FSign = (FDigit And 128) \ 128
FSign = 1 - 2 * FSign ' Sign completed

FExponent = FDigit And 127 ' Exponent started
FExponent = 16 * FExponent

FByte = ByteOrd7 + ByteOrd
FDigit = Desc(DescPoint + FByte)
FExponent = (FExponent + CDbl((FDigit And 240) \ 16)) - 1023
' Exponent completed
' ______________________________________________________________

FFraction = CDbl((FDigit And 15)) * DMult2 ' Fraction started