BNC 630 User Manual

Page 76

Advertising
background image

71

'******************************************************************************
' Subroutines
'
' These subroutines take a value in PointVal (which ranges from -1.0 to +1.0)
' and converts it to various data formats, (i.e. Floating Point, Binary,
' ASCII Hex, and Integer) and then sends that value to the 630.
'
' Before the first data point is sent, a Header consisting of two characters
' is sent to the 630. The first character of this header is a "W", which
' tells the 630 to expect arbitrary waveform data points. The second
' character of the header tells the 630 what data format to expect,
'
' "F" = Floating Point
' "I" = Integer
' "H" = ASCII Hexadecimal
' "B" = Binary
'
' Each subroutine gives a short example of each format.
'
'******************************************************************************

'--------------------- Send Floating Point data to 630 ---------------------
' This is the easiest format to use with Basic since no format conversion is
' necessary. Basic will output floating point numbers by default.
'
' Rules for floating point format:
'
' 1. The 630 expects all floating point values to be between -1.0 and +1.0.
' If a number falls outside that range, the number is set to -1.0 or +1.0.
' These correspond to the peak values of the waveform.
' If the output voltage level were set for 5V p-p, for example, then +1.0
' corresponds to +2.5V and -1.0 corresponds to -2.5V (across a 50 ohm load).
' For maximum signal fidelity, you should design your waveform so that the
' peak values "just fit" into the range of -1.0 to +1.0. You will then be
' using the full output range of the DAC.
'
' 2. To separate each number, you may use commas, tabs, spaces, carriage
' returns and/or linefeeds, semicolons, colons or basically any character
' that is not among the following:
' 0 1 2 3 4 5 6 7 8 9 . - + e E
'
' 3. You do not have to include an exponent (i.e. e-5). If no exponent is
' given, the 630 assumes that the exponent is 0.
'
' 4. Whitespace characters are not allowed between the mantissa and exponent.
'
' 5. Use of the "+" character for positive values is optional.
'
' 6. To set SYNC Out high during a data point, put a "p" or "P"
' BEFORE that data point. The "P" character may have whitespace around
' it if desired. SYNC Out is set low for all data points that
' do not have a "p" or "P" before them.
'
' Examples of floating point numbers, SYNC Out is set high on point #4:
'
' 0, .584737, 3457e-4, p .0004857e+3 -.000485 -1.0e-0
'------------------------------------------------------------------------------
SendFloat:

IF PointNumber = 1 THEN PRINT #1, "WF" ' Put header info before 1st data point

IF PointNumber = 2 THEN PRINT #1, "p" ' Set SYNC Out bit for second point

PRINT #1, PointVal ' Send Floating point number to 630
RETURN

Advertising