1   !*************************************************
2   !* DESCRIPTION:	Agilent E5100A/B Sample Program
3   !*
4   !* AUTHOR:		Agilent Technologies Japan, Ltd.
5   !* CREATED:		05/29/2001
6   !* PROGRAM NAME:	FILE1_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 (Instrument -> Controller)
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 INSTRUMENT ?        ";
220  INPUT Src_file$
230  PRINT Src_file$
240  !
250  PRINT "  ENTER DESTINATION FILE NAME ON CONTROLLER ?   ";
260  INPUT Dst_file$
270  PRINT Dst_file$
280  !
290  Copy_from_instr(@Agte5100,Src_file$,Dst_file$)
300  !
310  END
320  !
330  !  copy_from_instrument
340  !
350  SUB Copy_from_instr(@Agte5100,Src_file$,Dst_file$)
360      DIM Len$[6],Img$[32],Dmy$[2]
370      !
380      ON ERROR GOTO Skip_purge
390      PURGE Dst_file$
400 Skip_purge:  OFF ERROR
410      CREATE Dst_file$,1
420      ASSIGN @Dst_file TO Dst_file$
430      !
440      CLEAR @Agte5100
450      OUTPUT @Agte5100;"CLES"
460      OUTPUT @Agte5100;"ROPEN """;Src_file$;""""
470      IF FNCheck_error(@Agte5100,"<CPFI: ropen>")=-1 THEN SUBEXIT
480      !
490      LOOP
500          OUTPUT @Agte5100;"READ?"
510          ENTER @Agte5100 USING "#,2A";Dmy$
520          ENTER @Agte5100 USING "#,6A";Len$
530          Block_size=VAL(Len$)
540          !
550          IF Block_size=0 THEN
560              ENTER @Agte5100 USING "%,A";Dmy$
570              ASSIGN @Dst_file TO *
580              OUTPUT @Agte5100;"CLOSE"
590              SUBEXIT
600          END IF
610          !
620          ALLOCATE Dat$[Block_size]
630          Img$="#,"&VAL$(Block_size)&"A"
640          ENTER @Agte5100 USING Img$;Dat$
650          ENTER @Agte5100 USING "%,A";Dmy$
660          OUTPUT @Dst_file USING Img$;Dat$
670          DEALLOCATE Dat$
680          !
690          IF FNCheck_error(@Agte5100,"<CPFI: block read>")=-1 THEN SUBEXIT
700      END LOOP
710  SUBEND
720  !
730  !  Instrument Error Check
740  !
750  DEF FNCheck_error(@Agte5100,Str$)
760      DIM Err$[64]
770      OUTPUT @Agte5100;"OUTPERRO?"
780      ENTER @Agte5100;Err$
790      IF Err$<>"0,""No error""" THEN
800          PRINT "ERROR: ";Str$;"   ";Err$
810          RETURN -1
820      ELSE
830          RETURN 0
840      END IF
850  FNEND
