1   !*************************************************
2   !* DESCRIPTION:	Agilent E5100A/B Sample Program
3   !*
4   !* AUTHOR:		Agilent Technologies Japan, Ltd.
5   !* CREATED:		05/29/2001
6   !* PROGRAM NAME:	FILE2_E
7   !* REVISION:		A.02.00
8   !*
9   !*     Copyright (c) Agilent Technologies,
10 !*              All rights reserved.
11 !*
12 !*
13 !*  Customer shall have the personal, non-
14 !* transferable rights to use, copy or modify
15 !* this SAMPLE PROGRAM for Customer's internal
16 !* operations. Customer shall use the SAMPLE
17 !* PROGRAM solely and exclusively for its own
18 !* purpose and shall not license, lease, market
19 !* or distribute the SAMPLE PROGRAM or
20 !* modification or any part thereof.
21 !*
22 !*  Agilent Technologies shall not be liable for
23 !* the quality, performance or behavior of the
24 !* SAMPLE PROGRAM. Agilent Technologies especially
25 !* disclaims that the operation of the SAMPLE
26 !* PROGRAM shall be uninterrupted or error free.
27 !* This SAMPLE PROGRAM is provided AS IS.
28 !*
29 !*  AGILENT TECHNOLOGIES DISCLAIMS THE IMPLIED
30 !* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
31 !* A PARTICULAR PURPOSE.
32 !*
33 !*  Agilent Technologies shall not be liable for
34 !* any infringement of any patent, trademark,
35 !* copyright or other proprietary rights by the
36 !* SAMPLE PROGRAM or its use. Agilent Technologies
37 !* does not warrant that the SAMPLE PROGRAM is
38 !* free from infringements or such rights of third
39 !* parties. However, Agilent Technologies will not
40 !* knowingly infringe or deliver a software that
41 !* infringes the patent, trademark, copyright or
42 !* other proprietary right of a third party.
43 !*
44 !*************************************************
45 !
110  !
120  !  File transfer (Controller -> Instrument)
130  !
140  DIM Src_file$[50],Dst_file$[50]
150  ASSIGN @Agte5100 TO 717
160  OUTPUT @Agte5100;"*rst"
170  !
180  MASS STORAGE IS "a:\"
190  OUTPUT @Agte5100;"STODMEMO"
200  !
210  PRINT "  ENTER SOURCE FILE NAME ON CONTROLLER ?        ";
220  INPUT Src_file$
230  PRINT Src_file$
240  !
250  PRINT "  ENTER SOURCE FILE SIZE ?                      ";
260  INPUT Src_size
270  PRINT Src_size
280  !
290  PRINT "  ENTER DESTINATION FILE NAME ON INSTRUMENT ?   ";
300  INPUT Dst_file$
310  PRINT Dst_file$
320  !
330  Copy_to_instr(@Agte5100,Src_file$,Src_size,Dst_file$)
340  !
350  END
360  !
370  !  copy_to_instrument
380  !
390  SUB Copy_to_instr(@Agte5100,Src_file$,Src_size,Dst_file$)
400      DIM Img$[32]
410      Max_bsize=16384
420      !
430      ASSIGN @Src_file TO Src_file$
440      !
450      CLEAR @Agte5100
460      OUTPUT @Agte5100;"CLES"
470      OUTPUT @Agte5100;"WOPEN """;Dst_file$;""""
480      IF FNCheck_error(@Agte5100," <CPTI: wopen>")=-1 THEN SUBEXIT
490      Xfr_done=0
500      !
510      LOOP
520          SELECT (Src_size-Xfr_done)
530              CASE >Max_bsize
540                  Block_size=Max_bsize
550              CASE 0
560                  ASSIGN @Src_file TO *
570                  OUTPUT @Agte5100;"CLOSE"
580                  SUBEXIT
590              CASE ELSE
600                  Block_size=(Src_size-Xfr_done)
610          END SELECT
620          Xfr_done=Xfr_done+Block_size
630          !
640          ALLOCATE Dat$[Block_size]
650          !
660          Img$="#,"&VAL$(Block_size)&"A"
670          ENTER @Src_file USING Img$;Dat$
680          !
690          Img$="8A,ZZZZZZ,"&VAL$(Block_size)&"A"
700          OUTPUT @Agte5100 USING Img$;"WRITE #6",Block_size,Dat$,END
710          DEALLOCATE Dat$
720          IF FNCheck_error(@Agte5100," <CPTI: block write>")=-1 THEN SUBEXIT
730      END LOOP
740  SUBEND
750  !
760  !  Instrument Error Check
770  !
780  DEF FNCheck_error(@Agte5100,Str$)
790      DIM Err$[64]
800      OUTPUT @Agte5100;"OUTPERRO?"
810      ENTER @Agte5100;Err$
820      IF Err$<>"0,""No error""" THEN
830          PRINT "ERROR: ";Str$;"   ";Err$
840          RETURN -1
850      ELSE
860          RETURN 0
870      END IF
880  FNEND
