Specifications
4-5
Transferring USER Patterns over HP-IB
Pattern Upload/Download Example
6. Notice the way the header string is ENTERed during pattern Upload in lines 330 to 390
of the example. The ENTER USING “#,D” construct reads only the first two characters
in the pattern string (# and A, see 3 above) and the program assigns the “A” to a pattern
length variable (line 380).
The FOR NEXT loop in lines 460 to 490 then ENTERs the pattern length digits and
converts them to a value for pattern length.
7. The BINARY Pattern DATA is loaded into the Upat ( ) array in lines 410 to 530.
8. The header string must be constructed before downloading a pattern (line 550 of the
example). This is sent in line 630.
9. Pattern DATA is sent in the FOR NEXT loop in lines 640 to 760. The OUTPUT
USING “#,B” construct in line 670 allows data to be sent to the Error Detector (or
Pattern Generator) one byte at a time.
Here are tips for other coding languages:
Visual Basic
Here is an excerpt from a Visual Basic Program:
For j = 1 To 32768
Word$ = Word$ + Chr$(btx(j))
Next j
Call Send(det%, “PATT:FORM PACK,1” & Chr$(10)) Call Send(det%, “PATT:UPAT0 32768”
& Chr$(10))
Call Send(det%, “PATT:UPAT0:DATA #532768” & Word$ & Chr$(10))
This example is with Visual Basic 4 where the binary is obtained by using Chr&(0) or
Chr$(1) function.
Labview
This can be used for both data FORMAT packing types (1 bit per byte and 8 bits per byte).
The trick for Labview is to use the “Flatten to String” command.
1. Make the command and Header string.
2. For packed data (8 bits per byte), create an array (Integer8 type) formatted as binary or
hex (8 binary digits or 2 hex digits per array position).
3. For unpacked data (1 bit per byte), create an array of binary 1s and 0s.
4. Use “Flatten to String” repeatedly and concatenate each of these to form a train of
bytes. Concatenate this with the header created in step 1 above.