BNC 630 User Manual

Page 77

Advertising
background image

72

'------------------------- Send Integer data to 630 ----------------------
' This format sends a base 10 number which is in the range -2047 to +2047
'
' The integer numbers represent -1.0 to +1.0 as follows:
'
' -2047 ---- -1024 --- 0 ---- 1024 ---- 2047
' -1.0 -.5 0.0 +.5 +1.0
'
' Rules for Integer format:
'
' 1. The 630 expects all Integer values to be between -2047 and +2047.
' If a number falls outside that range, the number is set to -2047 or +2047.
' These correspond to the peak values of the waveform. If the output voltage
' level were set for 5V p-p, for example, then +2047 corresponds to +2.5V
' and -2047 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 +2047 to -2047. 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. Use of the "+" character for positive values is optional.
'
' 4. Leading "0"'s are ignored.
'
' 5. 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 integer numbers, SYNC Out is set high on point #3:
'
' 0, 123 p -411 -320 +12, +2017, -2047
'------------------------------------------------------------------------------

'---------------------- Send data point as Integer -------------------------
SendInteger:

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

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

' Convert the value in PointVal to an integer that ranges from -32767 to +32767

a = INT(PointVal * 2047) ' Convert -1.0, +1.0 val. to a -2047, +2047 val.

PRINT #1, a ' Send integer value to 630

RETURN

Advertising