Question:
How can two E1301 systems be synchronized using BANC-
350?
Answer:
This example demonstrates using two B-size systems that are synchronized to
better than 200usec using the BANC-350 IRIG-B interface between the two
slave B- size systems. The Banc-350 is a product manufactured by Bancomm-
Division of Datum Inc.
Master computer
Viper Card in Vectra QS/20
Program "IRIG_3"
|
|
|- ---------------HP-IB cable---------------|
| |
1st Remote B-size system 2nd Remote B-size system
IBASIC running program "IRIG_1" IBASIC running program "IRIG_2"
+-E1326B DVM E1236B DVM---------+
| E1345 mux E1345A mux |
| BANC-350 IRIG-B----------- cable-----------BANC-350 IRIG-B |
+-E1333A counter--------cable-----------------------------------+
The master computer is connected using HP-IB to the two slave B-size
systems. The HP-IB could have extenders inserted to make the distance be
much longer. The HP-IB interface doesn't provide timing thus it could be a
different interface or even eliminated. For this example, however, it
provides a convenient method to control and get the data from both systems.
The master computer is running the program "IRIG_3" which downloades
the program IRIG_1 to the first B-size system, and program IRIG_2 to the
2nd system (lines 630-870). It then told both programs to run (lines 900-
910).
It then setup the E1332 counter to measure the time interval between
the Voltmeter Complete pulse that comes out of each DVM on a BNC (lines
940,960,1160). The second dvm was programmed to trigger 100 msec latter
than the first so that I could be assured that the first DVM would start
1st, thus line 1170 prints out the counter time minus 100msec. See the
printout at the end of "IRIG_3" for the actual output.
The master computer serial polls to determine when the 1st B-size
system has finished its readings (lines 970-1000). It then asks both
remote B-size systems for both the time and value of the readings taken
and prints the results (lines1020-1140). The times has the format of
"day,hr,min,sec,msec".
The 1st B-size system runs program "IRIG_1" It first programs a
absolute time to the card (line 680). If a IRIG-B signal was available this
would not be necessary as the time would automatically be set. The 1st
BANC-350 then generates a time code signal that is passed to the 2nd system
using a coax cable. The two are now using the same time.
The BANC-350 once started can:
1) Record time when read by a program
2) Record time when a external signal arrives
3) Issue a external signal when a set time is reached.
The 3rd choice is used here. The time is read and then a time at
regular 10 sec intervals is calculated. The BANC-350 is then programed to
produce a Strobe Output which is connected to the DVM's External Trigger
BNC (lines 670- 1020).
The DVM is programmed to take readings when the External Trigger
signal arrives from the BANC-350 (lines 710,720). The DVM is serial polled
to determine when it has a reading available (lines 720,1040-1090).
A SRQ to the external master computer is generated when a scan has
completed (line 1100).
The program "IRIG_2" in the second B-size system is almost the same
except that it doesn't set time to the BANC-350 because the time code will
be comming from the 1st B-size system. It also doesn't pull SRQ as the 1st
system did and it triggers the DVM .1 sec latter than the first one. (line
1020.
Here are the programs. Note the print out from the master computer at
the end of program "IRIG_3"
=============== IRIG_3 Program in a Master computer ===================
10 ! re-save "IRIG_3"
20 ! This main line code is reserved as a error handling shell
30 ! All application code must be at lower level context
40 ASSIGN @Sys TO 70900 ! define I/O paths
50 ASSIGN @Ibasic1 TO 70930
60 ASSIGN @Ibasic2 TO 71030
70 ASSIGN @Counter TO 70906
80 COM @Sys,@Ibasic1,@Ibasic2,@Counter
90 ON TIMEOUT 7,15 GOTO End ! Turn TIMEOUTS to errors--this branch never
taken
100 ! This timeout should be longer than the downloaded
110 ! programs timeout
120 ON ERROR RECOVER Kaboom !This handles timeouts and errors not handled
130 ! at lower level contexts
140 Main ! Put application code in this sub
150 PRINT "Checking for errors at the end of program"
160 E13xx_errors
170 GOTO End
180 Kaboom:PRINT ""
190 PRINT ERRM$
200 PRINT "HERE IS THE E13XX ERROR STATUS"
210 E13xx_errors
220 End:END
230 !
240 SUB E13xx_errors !This sub reads all errors from E13xx instruments
250 COM @Sys,@Ibasic1,@Ibasic2,@Counter
260 DIM A$[128]
270 ABORT 7
280 CLEAR @Ibasic1
290 REPEAT
300 OUTPUT @Ibasic1;"SYST:ERR?"
310 ENTER @Ibasic1;A,A$
320 PRINT "IBASIC1 ERROR ";A$
330 UNTIL A=0
340 !
350 CLEAR @Ibasic2
360 REPEAT
370 OUTPUT @Ibasic2;"SYST:ERR?"
380 ENTER @Ibasic2;A,A$
390 PRINT "IBASIC2 ERROR ";A$
400 UNTIL A=0
410 !
420 CLEAR @Sys
430 REPEAT
440 OUTPUT @Sys;"SYST:ERR?"
450 ENTER @Sys;A,A$
460 PRINT "SYSTEM ERROR ";A$
470 UNTIL A=0
480 !
490 CLEAR @Counter
500 REPEAT
510 OUTPUT @Counter;"SYST:ERR?"
520 ENTER @Counter;A,A$
530 PRINT "COUNTER ERROR ";A$
540 UNTIL A=0
550 SUBEND
560 !
570 Main:SUB Main !This subroutine is treated as the main line
580 COM @Sys,@Ibasic1,@Ibasic2,@Counter
590 !
600 ! DOWNLOAD THE FILE "IRIG_1" TO @Ibasic1
610 !
620 DIM In$[160],Time1$[80],Time2$[80]
630 ASSIGN @File TO "IRIG_1";FORMAT ON
640 ON END @File GOTO Done1
650 CLEAR @Ibasic1
660 OUTPUT @Ibasic1;"*RST;*CLS;PROG:DEL:ALL"
670 OUTPUT @Ibasic1;"PROG:DEF #0"
680 LOOP
690 In$=""
700 ENTER @File;In$
710 OUTPUT @Ibasic1;In$
720 END LOOP
730 Done1:OUTPUT @Ibasic1;" " END
740 !
750 ! DOWNLOAD THE FILE "IRIG_2" TO @Ibasic2
760 !
770 ASSIGN @File TO "IRIG_2";FORMAT ON
780 ON END @File GOTO Done2
790 CLEAR @Ibasic2
800 OUTPUT @Ibasic2;"*RST;*CLS;PROG:DEL:ALL"
810 OUTPUT @Ibasic2;"PROG:DEF #0"
820 LOOP
830 In$=""
840 ENTER @File;In$
850 OUTPUT @Ibasic2;In$
860 END LOOP
870 Done2:OUTPUT @Ibasic2;" " END
880 !
890 ! NOW START THE PROGRAMS @IBASIC1, AND @IBASIC2
900 OUTPUT @Ibasic1;"PROG:STATE RUN" ! START PROGRAM IRIG_1 @IBASIC1
910 OUTPUT @Ibasic2;"PROG:STATE RUN" ! START PROGRAM IRIG_2 @IBACI2
920 !
930 ! PROGRAM COUNTER TO MEASURE TIME BETWEEN DVM1 AND DVM2 COMPLETE
940 OUTPUT @Counter;"CONF1:TINT;:SENS1:EVEN:LEV 1;:SENS2:EVEN:LEV 1"
950 LOOP
960 OUTPUT @Counter;"READ1?"! TRIGGER THE COUNTER
970 REPEAT
980 WAIT .1
990 Dvm_spoll=SPOLL(@Ibasic1)
1000 UNTIL Dvm_spoll<>0
1010 !
1020 !READ THE FIRST DVM
1030 OUTPUT @Ibasic1;"PROG:STR? Time"
1040 ENTER @Ibasic1;Time1$
1050 OUTPUT @Ibasic1;"PROG:NUMB? Dvm_reading"
1060 ENTER @Ibasic1;Dvm1_reading
1070 PRINT "TIME1= ",Time1$,"Dvm1_reading= ",Dvm1_reading
1080 !
1090 ! READ THE SECOND DMV
1100 OUTPUT @Ibasic2;"PROG:STR? Time"
1110 ENTER @Ibasic2;Time2$
1120 OUTPUT @Ibasic2;"PROG:NUMB? Dvm_reading"
1130 ENTER @Ibasic2;Dvm2_reading
1140 PRINT "TIME2= ",Time2$,"Dvm2_reading= ",Dvm2_reading
1150 !
1160 ENTER @Counter;C_time! READ THE COUNTER TO DETERMINE TIME BETWEEN TWO
DVM READINGS
1170 PRINT "TIME BETWEEN TWO DVM READINGS= ",C_time-.1
1180 PRINT ""
1190 END LOOP
1200 Main_:SUBEND
1210 !
TIME1= "1,0,0,20,000" Dvm1_reading= -2.912086
TIME2= "1,0,0,20,100" Dvm2_reading= -1.046638
TIME BETWEEN TWO DVM READINGS= -.000167944841
TIME1= "1,0,0,30,000" Dvm1_reading= -3.038086
TIME2= "1,0,0,30,100" Dvm2_reading= -1.060196
TIME BETWEEN TWO DVM READINGS= -.000173644535
TIME1= "1,0,0,40,000" Dvm1_reading= -3.089607
TIME2= "1,0,0,40,100" Dvm2_reading= -1.063721
TIME BETWEEN TWO DVM READINGS= -.000173244067
TIME1= "1,0,0,50,000" Dvm1_reading= -3.111397
TIME2= "1,0,0,50,100" Dvm2_reading= -1.066109
TIME BETWEEN TWO DVM READINGS= -.000168844499
TIME1= "1,0,1,00,000" Dvm1_reading= -3.125397
TIME2= "1,0,1,00,100" Dvm2_reading= -1.065353
TIME BETWEEN TWO DVM READINGS= -.000170444511
TIME1= "1,0,1,10,000" Dvm1_reading= -3.13723
TIME2= "1,0,1,10,100" Dvm2_reading= -1.065323
TIME BETWEEN TWO DVM READINGS= -.000174144655
TIME1= "1,0,1,20,000" Dvm1_reading= -3.144424
TIME2= "1,0,1,20,100" Dvm2_reading= -1.06601
TIME BETWEEN TWO DVM READINGS= -.000169744156
TIME1= "1,0,1,30,000" Dvm1_reading= -3.143684
TIME2= "1,0,1,30,100" Dvm2_reading= -1.066269
TIME BETWEEN TWO DVM READINGS= -.000171444751
TIME1= "1,0,1,40,000" Dvm1_reading= -3.143341
TIME2= "1,0,1,40,100" Dvm2_reading= -1.066757
TIME BETWEEN TWO DVM READINGS= -.000171044283
TIME1= "1,0,1,50,000" Dvm1_reading= -3.140282
TIME2= "1,0,1,50,100" Dvm2_reading= -1.066231
TIME BETWEEN TWO DVM READINGS= -.000174744427
===================== IRIG_1 PROGRAM IN 1st E1301 =======================
10 ! re-save "IRIG_1"
20 ! This main line code is reserved as a error handling shell
30 ! All application code must be at lower level context in SUB Main
40 ASSIGN @Sys TO 80900 ! define I/O paths
50 ASSIGN @Dvm TO 80903
60 ASSIGN @Irig TO 80925
70 COM /Instr/ @Sys,@Dvm,@Irig ! Use COM so command line I/O always works
80 COM /Results/ Time$[80],Dvm_reading
90 ON TIMEOUT 8,15 GOTO End ! Turn TIMEOUTS to errors--this branch never
taken
100 ON ERROR RECOVER Kaboom !This handles timeouts and errors not handled
110 ! at lower level contexts
120 ON KEY 1 LABEL "QUIT& ?" RECOVER Quit !KEY to quit & check for errors
130 ON KEY 2 LABEL "END!",15 RECOVER End !KEY to END now, no error check
140 Main ! Put application code in this sub
150 Quit:PRINT "Checking for E13xx Errors at the end of the program"
160 E13xx_errors
170 GOTO End
180 Kaboom:PRINT ""
190 PRINT ERRM$
200 PRINT "Checking for E13xx Errors as a BASIC Error has occurred"
210 E13xx_errors
220 End:END
230 !
240 E13xx_errors:SUB E13xx_errors ! This sub reads all errors from E13xx
instruments
250 COM /Instr/ @Sys,@Dvm,@Irig
260 COM /Results/ Time$[80],Dvm_reading
270 DIM A$[128]
280 ABORT 8 ! Free bus handshaking
290 ! Add a error loop for each instrument
300 !
310 CLEAR @Sys !Terminate instrument activity & clear input/output buffers
320 REPEAT !Read the entire instrument error que
330 OUTPUT @Sys;"SYST:ERR?"
340 ENTER @Sys;A,A$
350 PRINT "SYSTEM ERROR ";A$
360 UNTIL A=0
370 !
380 CLEAR @Dvm
390 REPEAT
400 OUTPUT @Dvm;"SYST:ERR?"
410 ENTER @Dvm;A,A$
420 PRINT "DVM ERROR ";A$
430 UNTIL A=0
440 !
450 CLEAR @Irig
460 REPEAT
470 OUTPUT @Irig;"SYST:ERR?"
480 ENTER @Irig;A,A$
490 PRINT "IRIG ERROR ";A$
500 UNTIL A=0
510 E13xx_errors_:SUBEND
520 !
530 Main:SUB Main !This subroutine is treated as the main line
540 COM /Instr/ @Sys,@Dvm,@Irig
550 COM /Results/ Time$[80],Dvm_reading
560 ! Time$ CONTAINS THE TIME THAT Dvm_reading WAS TAKEN AT
570 ! RESET THE INSTRUMENTS
580 DIM A$[80]
590 CLEAR @Irig
600 OUTPUT @Irig;"*RST;*CLS;*OPC?"
610 ENTER @Irig;A
620 CLEAR @Dvm
630 OUTPUT @Dvm;"*RST;*CLS;*OPC?"
640 ENTER @Dvm;A
650 !
660 ! PROGRAM IRIG AND DVM
670 ! CONNECT THE IRIG STROBE OUTPUT TO THE DVM EXT TRIGGER
680 OUTPUT @Irig;"SYST:IRIG:TIME 1,0,0,0" ! SET THE TIME TO ZERO
690 OUTPUT @Irig;"DIAG:SMOD MAJ" ! CONFIGURE FOR A OUTPUT PULSE WHEN MAJOR
TIME OCCURS
700 ! PROGRAM THE DVM TO DO A SCAN WHEN A EXTERNAL TRIGGER OCCURS
710 OUTPUT @Dvm;"CONF:VOLT:DC (@100)"! MEASURE CHANNEL 100
720 OUTPUT @Dvm;"TRIG:SOUR EXT;*SRE 16" ! TRIGGER FROM IRIG
730 ! NOW DO A ENDLESS LOOP
740 LOOP
750 ! READ THE TIME
760 OUTPUT @Irig;"MEAS:TIME?"
770 ENTER @Irig;A$
780 ! PROGRAM THE IRIG TO PROVIDE A STROBE OUTPUT AT CURRENT TIME + 10 SEC
790 ! CALCULATE THE NEXT 10 SEC INTERVAL
800 Sec=VAL(A$[8,9])
810 Min=VAL(A$[6,7])
820 Hr=VAL(A$[4,5])
830 Days=VAL(A$[1,3])
840 Sec=Sec+10
850 IF Sec>59 THEN
860 Sec=Sec MOD 60
870 Min=Min+1
880 ELSE
890 END IF
900 Sec$=VAL$(Sec)
910 IF Min>59 THEN
920 Min=Min MOD 60
930 Hr=Hr+1
940 ELSE
950 END IF
960 IF Hr>23 THEN
970 Days=Days+1
980 ELSE
990 END IF
1000 Time$=VAL$(Days)&","&VAL$(Hr)&","&VAL$(Min)&","&Sec$[1,1]&"0,000"
1010 Sday=POS(Time$,",")+1
1020 OUTPUT @Irig;"DIAG:SMAJ "&Time$[Sday]
1030 OUTPUT @Dvm;"READ?"
1040 REPEAT ! WAIT FOR DVM TO FINISH BEFORE ENTERING THE READING
1050 WAIT .011 ! SO THAT THE EXTERNAL COMPUTER CAN QUICKLY GET THE
READING
1060 UNTIL SPOLL(@Dvm)<>0
1070 ENTER @Dvm;A
1080 Dvm_reading=A
1090 PRINT Time$,Dvm_reading
1100 WRITEIO -9826,DVAL("1e9c00",16)+6;DVAL("698",16) ! PULL SRQ
1110 END LOOP
1120 Main_:SUBEND
1130 !
=================== IRIG_2 Program in the second E1301 ===================
10 ! re-save "IRIG_2"
20 ! This main line code is reserved as a error handling shell
30 ! All application code must be at lower level context in SUB Main
40 ASSIGN @Sys TO 80900. ! define I/O paths
50 ASSIGN @Dvm TO 80903.
60 ASSIGN @Irig TO 80929.
70 COM /Instr/ @Sys,@Dvm,@Irig ! Use COM so command line I/O always works
80 COM /Results/ Time$[80],Dvm_reading
90 ON TIMEOUT 8,15 GOTO End ! Turn TIMEOUTS to errors--this branch never
taken
100 ON ERROR RECOVER Kaboom !This handles timeouts and errors not handled
110 ! at lower level contexts
120 ON KEY 1 LABEL "QUIT& ?" RECOVER Quit !KEY to quit & check for errors
130 ON KEY 2 LABEL "END!",15 RECOVER End !KEY to END now, no error check
140 Main ! Put application code in this sub
150 Quit:PRINT "Checking for E13xx Errors at the end of the program"
160 E13xx_errors
170 GOTO End
180 Kaboom:PRINT ""
190 PRINT ERRM$
200 PRINT "Checking for E13xx Errors as a BASIC Error has occurred"
210 E13xx_errors
220 End:END
230 !
240 E13xx_errors:SUB E13xx_errors ! This sub reads all errors from E13xx
instruments
250 COM /Instr/ @Sys,@Dvm,@Irig
260 COM /Results/ Time$[80],Dvm_reading
270 DIM A$[128]
280 ABORT 8 ! Free bus handshaking
290 ! Add a error loop for each instrument
300 !
310 CLEAR @Sys !Terminate instrument activity & clear input/output buffers
320 REPEAT !Read the entire instrument error que
330 OUTPUT @Sys;"SYST:ERR?"
340 ENTER @Sys;A,A$
350 PRINT "SYSTEM ERROR ";A$
360 UNTIL A=0
370 !
380 CLEAR @Dvm
390 REPEAT
400 OUTPUT @Dvm;"SYST:ERR?"
410 ENTER @Dvm;A,A$
420 PRINT "DVM ERROR ";A$
430 UNTIL A=0
440 !
450 CLEAR @Irig
460 REPEAT
470 OUTPUT @Irig;"SYST:ERR?"
480 ENTER @Irig;A,A$
490 PRINT "IRIG ERROR ";A$
500 UNTIL A=0
510 E13xx_errors_:SUBEND
520 !
530 Main:SUB Main !This subroutine is treated as the main line
540 COM /Instr/ @Sys,@Dvm,@Irig
550 COM /Results/ Time$[80],Dvm_reading
560 ! Time$ CONTAINS THE TIME THAT Dvm_reading WAS TAKEN AT
570 ! RESET THE INSTRUMENTS
580 DIM A$[80]
590 CLEAR @Irig
600 OUTPUT @Irig;"*RST;*CLS;*OPC?"
610 ENTER @Irig;A
620 CLEAR @Dvm
630 OUTPUT @Dvm;"*RST;*CLS;*OPC?"
640 ENTER @Dvm;A
650 !
660 ! PROGRAM IRIG AND DVM
670 ! CONNECT THE IRIG STROBE OUTPUT TO THE DVM EXT TRIGGER
680 ! OUTPUT @Irig;"SYST:IRIG:TIME 1,0,0,0" ! SET TIME TO ZERO
690 OUTPUT @Irig;"DIAG:SMOD MAJ" ! CONFIGURE FOR A OUTPUT PULSE WHEN MAJOR
TIME OCCURS
700 ! PROGRAM THE DVM TO DO A SCAN WHEN A EXTERNAL TRIGGER OCCURS
710 OUTPUT @Dvm;"CONF:VOLT:DC (@100)"! MEASURE CHANNEL 100
720 OUTPUT @Dvm;"TRIG:SOUR EXT;*SRE 16" ! TRIGGER FROM IRIG
730 ! NOW DO A ENDLESS LOOP
740 WAIT 2
750 LOOP
760 ! READ THE TIME
770 OUTPUT @Irig;"MEAS:TIME?"
780 ENTER @Irig;A$
790 ! PROGRAM THE IRIG TO PROVIDE A STROBE OUTPUT AT CURRENT TIME + 10
SEC
800 ! CALCULATE THE NEXT 10 SEC INTERVAL
810 Sec=VAL(A$[8,9])
820 Min=VAL(A$[6,7])
830 Hr=VAL(A$[4,5])
840 Days=VAL(A$[1,3])
850 Sec=Sec+10
860 IF Sec>59 THEN
870 Sec=Sec MOD 60
880 Min=Min+1
890 ELSE
900 END IF
910 Sec$=VAL$(Sec)
920 IF Min>59 THEN
930 Min=Min MOD 60
940 Hr=Hr+1
950 ELSE
960 END IF
970 IF Hr>23 THEN
980 Days=Days+1
990 ELSE
1000 END IF
1010 ! SET THE TIME TO BE 100 MSEC AFTER A 10 SEC INTERVAL
1020 Time$=VAL$(Days)&","&VAL$(Hr)&","&VAL$(Min)&","&Sec$[1,1]&"0,100"
1030 Sday=POS(Time$,",")+1
1040 OUTPUT @Irig;"DIAG:SMAJ "&Time$[Sday]
1050 OUTPUT @Dvm;"READ?"
1060 REPEAT ! WAIT TILL DVM READING IS READY BEFORE ENTERING IT
1070 WAIT .011
1080 UNTIL SPOLL(@Dvm)<>0
1090 ENTER @Dvm;A
1100 Dvm_reading=A
1110 PRINT Time$,Dvm_reading
1120 END LOOP
1130 Main_:SUBEND
1140 !