
                                                                20-Nov-1990 18:09:02	VAX FORTRAN V5.4-79                 Page   1
                                                                14-Jul-1988 19:37:13	LIB4:[ADDASYS.SOURCE]ADDA_DEFINE.FOR;5      

0001    	PROGRAM    ADDA_DEFINE
0002    C
0003    C **************************************************************************
0004    C **  PROGRAM AUTHOR:       WILLIAM BAKER
0005    C 
0006    C **  PROGRAM DESCRIPTION:  CREATES DEFINITION OF TEST SETTINGS FOR
0007    C ** 			    THE WRITE_CONFIG ROUTINE TO WRITE.
0008    C
0009    C **  ADDA_DEFINE
0010    C     -----------
0011    C
0012    C **  DECLARE STRUCTURE OF THE A/D CHANNEL INFORMATION RECORD.
0013    C
0014    	STRUCTURE /AD_LIST/
0015    		UNION
0016    			MAP
0017    				INTEGER*4	CHAN_NUM	! CHANNEL NUMBER
0018    				INTEGER*4	CHAN_GAIN	! GAIN OF THE CHANNEL
0019    				CHARACTER*72	CHAN_DSCR	! STRING DESCRIPTION OF CHANNEL.
0020    			END MAP
0021    		END UNION
0022    	END STRUCTURE
0023    C
0024    C **  DECLARE STRUCTURE OF THE D/A CHANNEL INFORMATION RECORD.
0025    C
0026    	STRUCTURE /DA_LIST/
0027    		UNION
0028    			MAP
0029    				INTEGER*4	CHAN_NUM	! CHANNEL NUMBER
0030    				CHARACTER*72	CHAN_DSCR	! STRING DESCRIPTION OF CHANNEL
0031    				INTEGER*4	CHAN_DEVICE	! DEVICE PASSING OUTPUT DATA
0032    				INTEGER*4	CHAN_FROM	! CHANNEL ON DEVICE PASSING OUTPUT.
0033    			END MAP
0034    		END UNION
0035    	END STRUCTURE
0036    C
0037    C **  DELCARE RECORD FOR A/D CHANNELS.
0038    C
0039    	RECORD /AD_LIST/ AD_CHNL(16)
0040    C
0041    C **  DECLARE RECORD FOR D/A CHANNELS.
0042    C
0043    	RECORD /DA_LIST/ DA_CHNL(2)
0044    C
0045    C **  DECLARE LOCAL VARIABLES FOR NUMBER OF CHANNELS USED.
0046    C
0047    	INTEGER*4	AD_NMBER, DA_NMBER
0048    C
0049    C **  DECLARE LOCAL VARIABLES FOR PROCESSING CLOCK SETTINGS.
0050    C
0051    	INTEGER*4	CLK_DIVIDER, CLK_SOURCE
0052    	REAL*4		CLK_RATE
0053    C
0054    C **  DECLARE LOCAL VARIABLES FOR INDICATING WHICH DEVICE BEING CONFIGURED.
0055    C
0056    	CHARACTER*4	DEVICE, AD_IN
0057    C

ADDA_DEFINE                                                     20-Nov-1990 18:09:02	VAX FORTRAN V5.4-79                 Page   2
                                                                14-Jul-1988 19:37:13	LIB4:[ADDASYS.SOURCE]ADDA_DEFINE.FOR;5      

0058    C **  DECLARE COMMON FOR PASSING CLOCK INFORMATION TO/FROM SUBROUTINE.
0059    C
0060    	COMMON /CLOCK/ CLK_RATE, CLK_DIVIDER, CLK_SOURCE
0061    C
0062    C **  FIND OUT WHICH DEVICE NUMBER WE ARE PROCESSING.
0063    C
0064    	CALL LIB$GET_FOREIGN(AD_IN,'Device 1 or 2?  ',LEN_AD)
0065    	CALL STR$TRIM(AD_IN, AD_IN(1:LEN_AD), LEN_AD)
0066    C
0067    C **  DECODE THE DEVICE NUMBER STRING.
0068    C
0069    	DECODE(LEN_AD,250,AD_IN) IDEV
0070    250	FORMAT(I<LEN_AD>)
0071    C
0072    C **  CODE THE DEVICE STRING WITH THE ACTUAL DEVICE NAME USED BY SYSTEM.
0073    C
0074    	IF ((IDEV .EQ. 1) .OR. (IDEV .EQ. 2)) THEN
0075    		IF (IDEV .EQ. 1) DEVICE = 'AXA0'
0076    		IF (IDEV .EQ. 2) DEVICE = 'AXB0'
0077    	ENDIF
0078    C
0079    C **  SET THE DEFAULTS FOR FINDING OUT THE CLOCK RATE.
0080    C
0081    5850		CLK_DIVIDER = 1
0082    		CLK_SOURCE  = 0
0083    		CLK_RATE    = 100.0
0084    C
0085    C **  DISPLAY THE MENU FOR REQUESTING THE CLOCK RATE INFORMATION.
0086    C
0087    5020	TYPE *, ' '
0088    	TYPE *, ' '
0089    	TYPE *, '	SINCE YOU WILL BE USING THE KWV11-C CLOCK YOU MUST TELL'
0090    	TYPE *, '	THE PROGRAM AT WHAT CLOCK RATE TO RUN AT.  YOU CAN:'
0091    	TYPE *, ' '
0092    	TYPE *, '			<1> SPECIFY A CLOCK RATE, OR'
0093    	TYPE *, ' '
0094    	TYPE *, '			<2> DEFINE A CRYSTAL SOURCE AND A DIVIDER.'
0095    	TYPE *, '			    (WHICH WILL DEFINE A RATE...)'
0096    	TYPE *, ' '
0097    	TYPE *, '		ENTER AS FOLLOWS:'
0098    	TYPE *, ' '
0099    	TYPE *, '			ENTER <1> FOR A 1MHZ Crystal Source.'
0100    	TYPE *, '			ENTER <2> FOR A 100 kHZ Crystal Source.'
0101    	TYPE *, '			ENTER <3> FOR A 10 kHZ Crystal Source.'
0102    	TYPE *, '			ENTER <4> FOR A 1 kHZ Crystal Source.'
0103    	TYPE *, '			ENTER <5> FOR A 100 HZ Crystal Source.'
0104    	TYPE *, '			ENTER <9> TO Enter your desired rate directly.'
0105    	TYPE *, ' '
0106    C
0107    C **  GET THE CLOCK RATE CHOICE.
0108    C
0109    		WRITE(6,2020)
0110    2020		FORMAT('$			ENTER CHOICE:  ')
0111    		READ(5,8000) ICHC
0112    8000		FORMAT(I1)
0113    C
0114    C **  CHECK IF CHOICE FALLS IN CATEGORY FOR USING CRYSTAL SOURCE.

ADDA_DEFINE                                                     20-Nov-1990 18:09:02	VAX FORTRAN V5.4-79                 Page   3
                                                                14-Jul-1988 19:37:13	LIB4:[ADDASYS.SOURCE]ADDA_DEFINE.FOR;5      

0115    C
0116    			IF ((ICHC .EQ. 1) .OR. (ICHC .EQ. 2) .OR. (ICHC .EQ. 3) .OR.
0117         &			(ICHC .EQ. 4) .OR. (ICHC .EQ. 5) .OR. (ICHC .EQ. 9)) THEN
0118    C
0119    			CLK_DIVIDER = 1
0120    			IF (ICHC .LE. 5) CLK_SOURCE = ICHC
0121    			IF (ICHC .LE. 5) THEN
0122    C
0123    C **  ASK FOR THE DIVIDER IF CRYSTAL SOURCE WAS SELECTED.
0124    C
0125    	TYPE *, ' '
0126    	TYPE *, ' '
0127    	TYPE *, '			ENTER AN INTEGER DIVIDER FOR YOUR CLOCK SOURCE:'
0128    	TYPE *, '				( DEFAULT DIVIDER IS 1 )'
0129    	TYPE *, '				( MAXIMUM VALUE IS 8  )'
0130    	TYPE *, ' '
0131    C
0132    C **  GET THE DIVIDER NUMBER FOR THE CLOCK CRYSTAL SOURCE.
0133    C
0134    				WRITE(6,2023)
0135    2023	FORMAT('$			ENTER DIVIDER:  ')
0136    				IDIV = 0
0137    				READ(5,*) IDIV
0138    				IF (IDIV .NE. 0) CLK_DIVIDER = IDIV
0139    			ENDIF
0140    C
0141    C **  IF CHOICE IS TO ENTER CLOCK RATE MANUALLY, THEN REQUEST RATE.
0142    C
0143    			IF (ICHC .EQ. 9) THEN
0144    	TYPE *, ' '
0145    	TYPE *, ' '
0146    	TYPE *, '		ENTER A REAL NUMBER CLOCK RATE.  (USE DECIMAL POINT)'
0147    	TYPE *, '			   ( DEFAULT NUMBER IS 100. HERTZ )'
0148    	TYPE *, ' '
0149    C
0150    C **  GET THE CLOCK RATE FROM THE USER.
0151    C
0152    				WRITE(6,2026)
0153    2026		FORMAT('$			ENTER CLOCK RATE:  ')
0154    				RATE = 100.0
0155    				READ(5,*) RATE
0156    				IF (RATE .NE. 100.0) CLK_RATE = RATE
0157    			ENDIF
0158    C
0159    		ELSE
0160    C
0161    C **  BRANCH BACK TO CLOCK REQUEST IF IMPROPER INFORMATION INDICATED.
0162    C
0163    			GOTO 5020
0164    		ENDIF
0165    C
0166    C **  CHECK CLOCK RATE WITH THE CLOCK ITSELF.
0167    C
0168    5800		CALL DET_CLOCK
0169    C
0170    C **  TELL USER WHAT THE CLOCK SAYS THE RATE WILL BE.
0171    C

ADDA_DEFINE                                                     20-Nov-1990 18:09:02	VAX FORTRAN V5.4-79                 Page   4
                                                                14-Jul-1988 19:37:13	LIB4:[ADDASYS.SOURCE]ADDA_DEFINE.FOR;5      

0172    	TYPE *, ' '
0173    	TYPE *, '	IS THIS CLOCK RATE ACCEPTABLE TO YOU?'
0174    	TYPE *, ' '
0175    	TYPE *, '		ENTER <1> FOR YES.'
0176    	TYPE *, '		ENTER <2> FOR NO.'
0177    	TYPE *, ' '
0178    C
0179    C **  FIND OUT IF CLOCK RATE IS OK?
0180    C
0181    		WRITE(6,2800)
0182    2800	FORMAT('$			ENTER ANSWER:  ')
0183    				IANS = 1
0184    				READ(5,*) IANS
0185    C
0186    C **  IF WRONG INPUT THEN RE-ASK.
0187    				IF ((IANS .NE. 1) .AND. (IANS .NE. 2)) GOTO 5800
0188    C
0189    C **  IF RATE NOT CORRECT THEN RETURN TO SECTION AND REASK FOR CLOCK RATE.
0190    C
0191    				IF (IANS .EQ. 2) THEN
0192    	TYPE *, ' '
0193    	TYPE *, '	SINCE YOU ANSWERED NO TO THE ABOVE QUESTION ABOUT THE'
0194    	TYPE *, '	CLOCK RATE, I WILL RETURN YOU TO THE SERIES OF QUESTIONS'
0195    	TYPE *, '	RELATING TO SETTING THE CLOCK RATE.'
0196    	TYPE *, ' '
0197    					GOTO 5850
0198    				ENDIF
0199    C
0200    C **  CLOCK RATE OK, CONTINUING WITH PROGRAM.
0201    C
0202    C
0203    C **  FIND OUT NUMBER CHANNELS TO BE DECLARED FOR A/D OUTPUT.
0204    C
0205    5050	TYPE *, ' '
0206    	TYPE *, ' '
0207    	TYPE *, '	HOW MANY A/D CHANNELS WILL YOU BE USING ON DEVICE:  ',DEVICE
0208    	TYPE *, '		(MIN = 0, MAX = 16)'
0209    	TYPE *, ' '
0210    C
0211    C **  GET THE NUMBER OF D/A CHANNELS INFORMATION.
0212    C
0213    	WRITE(6,2050)
0214    2050	FORMAT('$			ENTER NUMBER:  ')
0215    	READ(5,*) IAD
0216    C
0217    C **  SEE IF NUMBER OF CHANNELS IS OK.
0218    C
0219    	IF ((IAD .GE. 0) .AND. (IAD .LE. 16)) THEN
0220    		AD_NMBER = IAD
0221    	ELSE
0222    		GOTO 5050
0223    	ENDIF
0224    C
0225    C **  NOW FIND OUT NUMBER OF D/A CHANNELS TO BE USED.
0226    C
0227    5060	TYPE *, ' '
0228    	TYPE *, ' '

ADDA_DEFINE                                                     20-Nov-1990 18:09:02	VAX FORTRAN V5.4-79                 Page   5
                                                                14-Jul-1988 19:37:13	LIB4:[ADDASYS.SOURCE]ADDA_DEFINE.FOR;5      

0229    	TYPE *, '	HOW MANY D/A CHANNELS WILL YOU BE USING ON DEVICE:  ',DEVICE
0230    	TYPE *, '		(MIN = 0, MAX = 2)'
0231    	TYPE *, ' '
0232    C
0233    C **  GET THE NUMBER OF D/A CHANNELS.
0234    C
0235    	WRITE(6,2050)
0236    	READ(5,*) IAD
0237    C
0238    C **  SEE IF NUMBER IS CORRECT.
0239    C
0240    	IF ((IAD .GE. 0) .AND. (IAD .LE. 2)) THEN
0241    		DA_NMBER = IAD
0242    	ELSE
0243    		GOTO 5060
0244    	ENDIF
0245    C
0246    C **  BOTH CHANNEL COUNTS ARE ZERO, ISSUE MESSAGE
0247    C
0248    	IF ((DA_NMBER .EQ. 0) .AND. (AD_NMBER .EQ. 0)) THEN
0249    		TYPE *, ' '
0250    		TYPE *, ' '
0251    		TYPE *, ' '
0252    		TYPE *, ' '
0253    		TYPE *, '	WHY DID YOU BOTHER?'
0254    		TYPE *, ' '
0255    		TYPE *, ' '
0256    		TYPE *, ' '
0257    		TYPE *, ' '
0258    		GOTO 5050
0259    	ENDIF
0260    C
0261    C **  SET A MARKER FOR THE PREVIOUS CHANNEL DECLARED.
0262    C
0263    	IPRV = 0
0264    C
0265    C **  INITIALIZE THE A/D CHANNELS TO SPECIFIC VALUES.
0266    C
0267    	DO II = 1,16
0268    		AD_CHNL(II).CHAN_NUM = II - 1
0269    		AD_CHNL(II).CHAN_GAIN = -9
0270    		AD_CHNL(II).CHAN_DSCR = 'NOT USED BY THIS TEST.'
0271    	ENDDO
0272    C
0273    C **  SET MIN CHANNEL MARKER, AND MAX CHANNEL MARKER.
0274    C
0275    	MAX_CHAN = 0
0276    	MIN_CHAN = 16
0277    C
0278    C **  IF NUMBER OF A/D CHANNELS IS GREATER THAN ZERO, THEN GET INFORMATION.
0279    C
0280    	IF (AD_NMBER .GT. 0) THEN
0281    C
0282    C **  LOOP TILL WE GET ALL THE CHANNELS WE NEED.
0283    C
0284    		DO II = 1,AD_NMBER
0285    C

ADDA_DEFINE                                                     20-Nov-1990 18:09:02	VAX FORTRAN V5.4-79                 Page   6
                                                                14-Jul-1988 19:37:13	LIB4:[ADDASYS.SOURCE]ADDA_DEFINE.FOR;5      

0286    C **  WARN USER TO READY WITH INFORMATION.
0287    C
0288    	TYPE *, ' '
0289    	TYPE *, '		BE PREPARED TO ENTER THE FOLLOWING FOR EACH A/D CHANNEL:'
0290    	TYPE *, ' '
0291    	TYPE *, '			CHANNEL NUMBER,		(0 - 15)'
0292    	TYPE *, '			CHANNEL DESCRIPTION.    (72 Char)'
0293    	TYPE *, ' '
0294    	TYPE *, ' '
0295    	TYPE *, ' '
0296    C
0297    C **  GET CHANNEL NUMBER TO BE CONFIGURED.
0298    C
0299    5200			WRITE(6,2200)
0300    2200	FORMAT('$	ENTER CHANNEL NUMBER:    ')
0301    			READ(5,*) ICHN
0302    C
0303    C **  CHECK IF NUMBER ENTERED IS OK FOR PROGRAMS.
0304    C
0305    			IF ((ICHN .LT. 0) .AND. (ICHN .GT. 15)) THEN
0306    				TYPE *, ' '
0307    				TYPE *, 'RE-ENTER THE CHANNEL NUMBER.'
0308    				TYPE *, ' '
0309    				GOTO 5200
0310    			ENDIF
0311    C
0312    C **  SET THE CHANNEL BEING USED.
0313    C
0314    			AD_CHNL(ICHN+1).CHAN_NUM = ICHN
0315    C
0316    C **  SET THE MIN AND MAX CHANNEL NUMBER CHANNELS.
0317    C
0318    			IF (MAX_CHAN .LT. ICHN) MAX_CHAN = ICHN
0319    			IF (MIN_CHAN .GT. ICHN) MIN_CHAN = ICHN
0320    C
0321    C **  GET THE CHANNEL DESCRIPTION.
0322    C
0323    			AD_CHNL(ICHN+1).CHAN_DSCR = ' '
0324    5240			WRITE(6,2240)
0325    2240	FORMAT('$	ENTER CHANNEL DESCRIPT:  ')
0326    			READ(5,2260) LLEN, AD_CHNL(ICHN+1).CHAN_DSCR(1:LLEN)
0327    2260	FORMAT(Q,A<LLEN>)
0328    C
0329    C **  SHOW LATEST CHANNEL INFORMATION FOR A/D CHANNELS.
0330    C
0331    	TYPE *, ' '
0332    	TYPE *, ' '
0333    	TYPE *, ' ##  CH#  DESCRIPTION:'
0334    			WRITE(6,3000)	(KK, AD_CHNL(KK).CHAN_NUM, 
0335         &					AD_CHNL(KK).CHAN_DSCR(1:60), 
0336         &					KK=(MIN_CHAN+1),(MAX_CHAN+1))
0337    3000			FORMAT(1X,I2,2X,I2,2X,A60)
0338    C
0339    C **  LOOP BACK FOR NEXT CHANNEL TO BE DECLARED.
0340    C
0341    		ENDDO
0342    C

ADDA_DEFINE                                                     20-Nov-1990 18:09:02	VAX FORTRAN V5.4-79                 Page   7
                                                                14-Jul-1988 19:37:13	LIB4:[ADDASYS.SOURCE]ADDA_DEFINE.FOR;5      

0343    C **  TELL THE USER ABOUT JUMPERING THE CHANNELS TO GROUND IF LEFT UNUSED.
0344    C
0345    	TYPE *, ' '
0346    	TYPE *, ' '
0347    	TYPE *, '		ANY CHANNELS SHOWN AS:  NOT USED BY THIS TEST'
0348    	TYPE *, ' '
0349    	TYPE *, '		MUST BE JUMPERED TO GROUND BEFORE THE TEST BEGINS.'
0350    	TYPE *, ' '
0351    	TYPE *, ' '
0352    	TYPE *, ' '
0353    	TYPE *, '		BE PREPARED TO ENTER THE A/D CHANNEL GAIN TO BE USED.'
0354    	TYPE *, ' '
0355    	TYPE *, ' '
0356    	TYPE *, '		SINCE THE INTERFACE IN USE IS OF TYPE ASYNCHRONOUS,'
0357    	TYPE *, '		THE VALUE FOR GAIN DEFAULTS TO THE VALUE GIVEN FOR'
0358    	TYPE *, '		THE LOWEST CHANNEL ENTERED.  THE REMAINING CHANNEL'
0359    	TYPE *, '		GAINS ARE SET IDENTICLE TO THE LOWEST CHANNEL.'
0360    	TYPE *, ' '
0361    C
0362    C **  SINCE ASYNCHRONOUS DEVICES ONLY HAVE A SINGLE GAIN, WE'LL GET IT ONCE.
0363    C **  THEN APPLY SAME GAIN TO ALL THE CHANNELS OF THE DEVICE.
0364    C
0365    C **  GET THE CHANNEL GAIN FOR THIS TEST.
0366    C
0367    5220			WRITE(6,2220)
0368    2220	FORMAT('$	ENTER CHANNEL GAIN:      ')
0369    			READ(5,*) IGN
0370    			IF (IGN .LE. 0) GOTO 5220
0371    C
0372    C **  SET THE CHANNEL GAIN TO ALL THE CHANNELS.
0373    C
0374    			DO II = 1,16
0375    				AD_CHNL(II).CHAN_GAIN = IGN
0376    			ENDDO
0377    C
0378    	ENDIF
0379    C
0380    C **  RESET THE NUMBER OF CHANNELS USED AS DETERMINED BY MIN & MAX POINTERS.
0381    C
0382    	AD_NMBER = MAX_CHAN - MIN_CHAN + 1
0383    C
0384    C **  RESET PREVIOUS POINTER VARIABLE TO ZERO.
0385    C
0386    	IPRV = 0
0387    C
0388    C **  INITIALIZE THE D/A INFORMATION RECORD.
0389    C
0390    	DO II = 1,2
0391    		DA_CHNL(II).CHAN_NUM = 9
0392    		DA_CHNL(II).CHAN_DEVICE = 9
0393    		DA_CHNL(II).CHAN_FROM = 99
0394    		DA_CHNL(II).CHAN_DSCR = 'NOT USED BY THIS TEST.'
0395    	ENDDO
0396    C
0397    C **  CHECK IF WE NEED TO GET D/A INFORMATION.
0398    C
0399    	IF (DA_NMBER .GT. 0) THEN

ADDA_DEFINE                                                     20-Nov-1990 18:09:02	VAX FORTRAN V5.4-79                 Page   8
                                                                14-Jul-1988 19:37:13	LIB4:[ADDASYS.SOURCE]ADDA_DEFINE.FOR;5      

0400    C
0401    C **  IF D/A INFORMATION REQUIRED THEN LOOP TILL BOTH CHANNELS PROVIDED.
0402    C
0403    		DO II = 1,DA_NMBER
0404    C
0405    C **  TELL USER WHAT INFORMATION HE WILL NEED TO PROVIDE.
0406    C
0407    	TYPE *, ' '
0408    	TYPE *, ' '
0409    	TYPE *, ' '
0410    	TYPE *, '		BE PREPARED TO ENTER THE FOLLOWING FOR EACH D/A CHANNEL:'
0411    	TYPE *, ' '
0412    	TYPE *, '			CHANNEL NUMBER,		(0 - 1)'
0413    	TYPE *, '			SOURCE DEVICE,		(1, 2 or 9)'
0414    	TYPE *, '			SOURCE CHANNEL,		(0 - 15)'
0415    	TYPE *, '			CHANNEL DESCRIPTION.    (72 Char)'
0416    	TYPE *, ' '
0417    	TYPE *, '		CHANNELS MUST BE ENTERED IN SEQUENTIAL ORDER, FROM'
0418    	TYPE *, '		LOWEST CHANNEL NUMBER TO HIGHEST CHANNEL NUMBER.'
0419    	TYPE *, ' '
0420    C
0421    C **  GET THE D/A CHANNEL NUMBER TO BE CONFIGURED.
0422    C
0423    5400			WRITE(6,2400)
0424    2400	FORMAT('$	ENTER CHANNEL NUMBER:    ')
0425    			READ(5,*) ICHN
0426    C
0427    C **  CHECK TO SEE IF CHANNEL NUMBER IS OK.
0428    C
0429    			IF ((ICHN .LT. 0) .AND. (ICHN .GT. 1)) THEN
0430    				TYPE *, 'RE-ENTER THE CHANNEL NUMBER.'
0431    				GOTO 5400
0432    			ENDIF
0433    C
0434    C **  CHECK IF CHANNEL NUMBER IS APPROPRIATE FOR  THIS TEST, AND IS
0435    C **  BEING DECLARED IN THE PROPER ORDER.
0436    C
0437    			IF (ICHN .LT. IPRV) THEN
0438    				TYPE *, ' '
0439    				TYPE *, 'RE-ENTER THE CHANNEL NUMBER, MUST BE GREATER THAN: ',IPRV
0440    				TYPE *, ' '
0441    				GOTO 5400
0442    			ENDIF
0443    			IPRV = ICHN
0444    C
0445    C **  SET THE CHANNEL NUMBER SELECTED TO THE D/A INFORMATION RECORD.
0446    C
0447    			DA_CHNL(II).CHAN_NUM = ICHN
0448    C
0449    C **  ASK WHERE THE SOURCE OF DATA WILL BE FOR THE D/A CHANNEL.
0450    C
0451    5410	TYPE *, ' '
0452    	TYPE *, '	ENTER THE SOURCE DEVICE.  SINCE WE HAVE TWO DEVICES (AXA0 AND AXB0)'
0453    	TYPE *, '	YOU CAN DIRECT THE A/D INPUT FROM EITHER DEVICE TO THE D/A OUTPUT'
0454    	TYPE *, '	ON EITHER DEVICE.  YOU CAN ALSO DESIGNATE THAT A USER PROGRAM WILL'
0455    	TYPE *, '	PROVIDE THE DATA FOR THE D/A OUTPUT CHANNEL BEING CONFIGURED.'
0456    	TYPE *, ' '

ADDA_DEFINE                                                     20-Nov-1990 18:09:02	VAX FORTRAN V5.4-79                 Page   9
                                                                14-Jul-1988 19:37:13	LIB4:[ADDASYS.SOURCE]ADDA_DEFINE.FOR;5      

0457    	TYPE *, '		ENTER <1> FOR DEVICE AXA0:'
0458    	TYPE *, '		ENTER <2> FOR DEVICE AXB0:'
0459    	TYPE *, ' '
0460    	TYPE *, '		ENTER <9> FOR USER PROGRAM.'
0461    	TYPE *, ' '
0462    C
0463    C **  GET THE SOURCE DEVICE INFORMATION.
0464    C
0465    			WRITE(6,2410)
0466    2410	FORMAT('$	ENTER SOURCE DEVICE:    ')
0467    			READ(5,*) IDEV
0468    C
0469    C **  CHECK IF SOURCE DEVICE IS CORRECT.
0470    C
0471    			IF ((IDEV .NE. 1) .AND. (IDEV .NE. 2) .AND. (IDEV .NE. 9)) THEN
0472    				TYPE *, ' '
0473    				TYPE *, 'RE-ENTER THE SOURCE DEVICE, INCORRECT VALUE ENTERED.'
0474    				TYPE *, ' '
0475    				GOTO 5410
0476    			ENDIF
0477    C
0478    C **  SET THE SOURCE DEVICE POINTER IN THE D/A INFORMATION RECORD.
0479    C
0480    			DA_CHNL(II).CHAN_DEVICE = IDEV
0481    C
0482    C **  IF THE SOURCE DEVICE WILL NOT BE A USER PROGRAM , THEN GET THE CHANNEL.
0483    C
0484    			IF (IDEV .NE. 9) THEN
0485    C
0486    C **  DISPLAY REQUEST FOR THE CHANNEL ON THE SOURCE DEVICE BEING USED.
0487    C
0488    5420	TYPE *, ' '
0489    	TYPE *, '	ENTER THE SOURCE CHANNEL ON THE SOURCE DEVICE.'
0490    	TYPE *, '	THIS IS THE CHANNEL YOU WISH TO IMMEDIATELY'
0491    	TYPE *, '	REDIRECT ITS VALUE TO THE D/A OUTPUT'
0492    	TYPE *, ' '
0493    C
0494    C **  GET THE CHANNEL NUMBER.
0495    C
0496    				WRITE(6,2420)
0497    2420	FORMAT('$	ENTER SOURCE CHANNEL:    ')
0498    				READ(5,*) ICHN
0499    C
0500    C **  CHECK IF THE CHANNEL NUMBER IS OK.
0501    C
0502    				IF ((ICHN .LT. 0) .AND. (ICHN .GT. 15)) THEN
0503    	TYPE *, ' '
0504    	TYPE *, 'RE-ENTER THE SOURCE CHANNEL, INCORRECT VALUE ENTERED.'
0505    	TYPE *, ' '
0506    					GOTO 5420
0507    				ENDIF
0508    C
0509    C **  SET THE D/A INFORMATION RECORD WITH SOURCE CHANNEL NUMBER.
0510    C
0511    				DA_CHNL(II).CHAN_FROM = ICHN
0512    C
0513    			ENDIF

ADDA_DEFINE                                                     20-Nov-1990 18:09:02	VAX FORTRAN V5.4-79                 Page  10
                                                                14-Jul-1988 19:37:13	LIB4:[ADDASYS.SOURCE]ADDA_DEFINE.FOR;5      

0514    C
0515    C **  GET THE DESCRIPTION OF THE D/A CHANNEL BEING CONFIGURED.
0516    C
0517    	TYPE *, ' '
0518    			DA_CHNL(II).CHAN_DSCR = ' '
0519    5440			WRITE(6,2440)
0520    2440	FORMAT('$	ENTER CHANNEL DESCRIPTION:  ')
0521    C
0522    C **  READ THE D/A CHANNEL DESCRIPTION.
0523    C
0524    			READ(5,2460) LLEN, DA_CHNL(II).CHAN_DSCR(1:LLEN)
0525    2460	FORMAT(Q,A<LLEN>)
0526    C
0527    C **  SHOW THE D/A CHANNELS CONFIGURED.
0528    C
0529    	TYPE *, ' '
0530    	TYPE *, ' '
0531    	TYPE *, ' ##  CH# DV# FM# DESCRIPTION:'
0532    			WRITE(6,3050)	(KK, DA_CHNL(KK).CHAN_NUM, DA_CHNL(KK).CHAN_DEVICE, 
0533         &					DA_CHNL(KK).CHAN_FROM, DA_CHNL(KK).CHAN_DSCR(1:60), KK=1,II)
0534    3050			FORMAT(1X,I2,2X,I2,2X,I2,2X,I2,2X,A60)
0535    C
0536    		ENDDO
0537    C
0538    	ENDIF
0539    C
0540    C **  WRITE OUT THE DEVICE DEFINITION FILE NOW.
0541    C
0542    	TYPE *, ' '
0543    	TYPE *, '	WRITING THE DEFINITION FOR DEVICE:  ',DEVICE
0544    	TYPE *, ' '
0545    C
0546    C **  OPEN THE FILE FOR THE DEVICE CONFIGURATION INFORMATION.
0547    C
0548    	OPEN(UNIT=11,	FILE='ADDA_LOAD_FILE',  CARRIAGECONTROL = 'LIST',
0549         &			TYPE = 'NEW', FORM = 'FORMATTED')
0550    C
0551    C **  WRITE OUT THE CLOCK RATE.
0552    C
0553    	WRITE(11,200) CLK_RATE
0554    200	FORMAT('%RT=',F12.2)
0555    C
0556    C **  WRITE OUT THE NUMBER OF CHANNELS INFORMATION.
0557    C
0558    	WRITE(11,400) AD_NMBER, DA_NMBER
0559    400	FORMAT('%AN=',I2,2X,'%DN=',I1)
0560    C
0561    C **  WRITE OUT THE A/D CHANNELS INFORMATION.
0562    C
0563    	IF (AD_NMBER .GT. 0)
0564         &		WRITE(11,500) ( AD_CHNL(II).CHAN_NUM,
0565         &			AD_CHNL(II).CHAN_GAIN,
0566         &			AD_CHNL(II).CHAN_DSCR, II=(MIN_CHAN+1),(MAX_CHAN+1))
0567    500	FORMAT('%AD=',I2,2X,'%GA=',I6,2X,'%DE=',A72)
0568    C
0569    C **  WRITE OUT THE D/A CHANNELS INFORMATION.
0570    C

ADDA_DEFINE                                                     20-Nov-1990 18:09:02	VAX FORTRAN V5.4-79                 Page  11
                                                                14-Jul-1988 19:37:13	LIB4:[ADDASYS.SOURCE]ADDA_DEFINE.FOR;5      

0571    	IF (DA_NMBER .GT. 0)
0572         &		WRITE(11,600) ( DA_CHNL(II).CHAN_NUM,
0573         &			DA_CHNL(II).CHAN_DEVICE,
0574         &			DA_CHNL(II).CHAN_FROM,
0575         &			DA_CHNL(II).CHAN_DSCR, II=1,2)
0576    600	FORMAT('%DA=',I2,2X,'%DV=',I1,2X,'%FM=',I2,2X,'%DE=',A72)
0577    C
0578    C **  CLOSE CONFIGURATION FILE.
0579    C
0580    	CLOSE(11)
0581    C
0582    	END




PROGRAM SECTIONS

    Name				 Bytes   Attributes

  0 $CODE                                 5863   PIC CON REL LCL   SHR   EXE   RD NOWRT LONG
  1 $PDATA                                3092   PIC CON REL LCL   SHR NOEXE   RD NOWRT LONG
  2 $LOCAL                                2744   PIC CON REL LCL NOSHR NOEXE   RD   WRT LONG
  3 CLOCK                                   12   PIC OVR REL GBL   SHR NOEXE   RD   WRT LONG

    Total Space Allocated                11711


ENTRY POINTS

    Address  Type  Name          

  0-00000000       ADDA_DEFINE   


VARIABLES

    Address  Type  Name              Address  Type  Name              Address  Type  Name              Address  Type  Name          

  2-000005AC  CHAR AD_IN               **      I*4  AD_NMBER        3-00000004  I*4  CLK_DIVIDER     3-00000000  R*4  CLK_RATE      
  3-00000008  I*4  CLK_SOURCE          **      I*4  DA_NMBER        2-000005A8  CHAR DEVICE          2-000005C8  I*4  IAD           
  2-000005C4  I*4  IANS            2-000005B8  I*4  ICHC            2-000005CC  I*4  ICHN            2-000005B4  I*4  IDEV          
  2-000005BC  I*4  IDIV            2-000005D4  I*4  IGN                 **      I*4  II                  **      I*4  IPRV          
      **      I*4  KK              2-000005B0  I*4  LEN_AD          2-000005D0  I*4  LLEN                **      I*4  MAX_CHAN      
      **      I*4  MIN_CHAN        2-000005C0  R*4  RATE          


RECORD ARRAYS

    Address   Name          Structure           Bytes  Dimensions

  2-00000000  AD_CHNL       AD_LIST              1280  (16)
  2-00000500  DA_CHNL       DA_LIST               168  (2)

ADDA_DEFINE                                                     20-Nov-1990 18:09:02	VAX FORTRAN V5.4-79                 Page  12
01                                                              14-Jul-1988 19:37:13	LIB4:[ADDASYS.SOURCE]ADDA_DEFINE.FOR;5      

LABELS

    Address   Label       Address   Label       Address   Label       Address   Label       Address   Label       Address   Label   

  1-00000B9D  200'      1-00000A1A  250'      1-00000BA7  400'      1-00000BBA  500'      1-00000BD7  600'      1-00000A21  2020'   
  1-00000A3A  2023'     1-00000A51  2026'     1-00000A81  2050'     1-00000A97  2200'     1-00000AE8  2220'     1-00000AB5  2240'   
  1-00000AD3  2260'     1-00000B06  2400'     1-00000B24  2410'     1-00000B41  2420'     1-00000B5F  2440'     1-00000B80  2460'   
  1-00000A6B  2800'     1-00000ADB  3000'     1-00000B88  3050'     0-00000088  5020      0-00000664  5050      0-00000740  5060    
  0-00000A50  5200      0-00000DE0  5220          **      5240      0-00000FF4  5400      0-000010D0  5410          **      5420    
      **      5440      0-000004D8  5800      0-00000070  5850      1-00000A37  8000'   


FUNCTIONS AND SUBROUTINES REFERENCED

  Type  Name                              Type  Name                              Type  Name                            

        DET_CLOCK                               FOR$CLOSE                               FOR$OPEN                        
        LIB$GET_FOREIGN                         STR$TRIM                        

                                                                20-Nov-1990 18:09:02	VAX FORTRAN V5.4-79                 Page  13
                                                                14-Jul-1988 19:37:13	LIB4:[ADDASYS.SOURCE]ADDA_DEFINE.FOR;5      

0002    	SUBROUTINE DET_CLOCK()
0003    C
0004    C **  DECLARE LOCAL VARIABLES NEEDED BY SUBROUTINE.
0005    C
0006    	INTEGER*4	STATUS_C, CLOCK_ID, CLK_SOURCE, CLK_DIVIDER
0007    C
0008    C **  DECLARE PARAMETERS NEEDED BY SUBROUTINE TO GET CLOCK STARTED.
0009    C
0010    	INCLUDE 'SYS$SHARE:LIOSET.FOR'
0699    C
0700    C **  DECLARE COMMON USED TO PASS INFORMATION BACK TO MAIN PROGRAM.
0701    C
0702    	COMMON /CLOCK/ CLK_RATE, CLK_DIVIDER, CLK_SOURCE
0703    C
0704    C***
0705    C	ATTACH THE CLOCK MODULE, AND SET IT UP.
0706    C***
0707    C
0708    	STATUS_C = LIO$ATTACH( CLOCK_ID, 'KZA0', LIO$K_QIO )
0709    		IF (.NOT. (STATUS_C)) CALL LIB$SIGNAL(%VAL(STATUS_C))
0710    C
0711    C **  SET A CLOCK RATE.
0712    C
0713    	IF (CLK_SOURCE .EQ. 0) THEN
0714    		STATUS_C = LIO$SET_R( CLOCK_ID, LIO$K_CLK_RATE, 1, CLK_RATE)
0715    			IF (.NOT. (STATUS_C)) CALL LIB$SIGNAL(%VAL(STATUS_C))
0716    	ELSE
0717    C
0718    C **  OR SET A SOURCE AND DIVIDER.
0719    C
0720    		STATUS_C = LIO$SET_I( CLOCK_ID, LIO$K_CLK_SRC, 2, CLK_SOURCE, CLK_DIVIDER )
0721    			IF (.NOT. (STATUS_C)) CALL LIB$SIGNAL(%VAL(STATUS_C))
0722    	ENDIF
0723    C
0724    C **  RETRIEVE THE ACTUAL RATE SET BY THE CLOCK.
0725    C
0726    	STATUS_C = LIO$SHOW( CLOCK_ID, LIO$K_CLK_RATE, ACT_RATE, ILEN )
0727    		IF (.NOT. (STATUS_C)) CALL LIB$SIGNAL(%VAL(STATUS_C))
0728    C
0729    	IWAIT = 0
0730    C
0731    C **  DETACH THE CLOCK FROM THE PROGRAM.
0732    C
0733    	STATUS_C = LIO$DETACH( CLOCK_ID, IWAIT )
0734    		IF (.NOT. (STATUS_C)) CALL LIB$SIGNAL(%VAL(STATUS_C))
0735    C
0736    C **  TELL USER THE ACTUAL RATE TO BE USED BY THE  PROGRAM.
0737    C
0738    	TYPE *, ' '
0739    	TYPE *, 'ACTUAL CLOCK RATE WILL BE:  ', ACT_RATE, ' HERTZ.'
0740    	TYPE *, ' '
0741    C
0742    C **  SET THE VARIABLE TO BE PASSED BACK TO THE CALLING PROGRAM VIA COMMON.
0743    C
0744    	CLK_RATE = ACT_RATE
0745    C

DET_CLOCK                                                       20-Nov-1990 18:09:02	VAX FORTRAN V5.4-79                 Page  14
                                                                14-Jul-1988 19:37:13	LIB4:[ADDASYS.SOURCE]ADDA_DEFINE.FOR;5      

0746    	RETURN
0747    	END




PROGRAM SECTIONS

    Name				 Bytes   Attributes

  0 $CODE                                  259   PIC CON REL LCL   SHR   EXE   RD NOWRT LONG
  1 $PDATA                                  61   PIC CON REL LCL   SHR NOEXE   RD NOWRT LONG
  2 $LOCAL                                 188   PIC CON REL LCL NOSHR NOEXE   RD   WRT LONG
  3 CLOCK                                   12   PIC OVR REL GBL   SHR NOEXE   RD   WRT LONG

    Total Space Allocated                  520


ENTRY POINTS

    Address  Type  Name          

  0-00000000       DET_CLOCK     


VARIABLES

    Address  Type  Name              Address  Type  Name              Address  Type  Name              Address  Type  Name          

  2-00000004  R*4  ACT_RATE        3-00000004  I*4  CLK_DIVIDER     3-00000000  R*4  CLK_RATE        3-00000008  I*4  CLK_SOURCE    
  2-00000000  I*4  CLOCK_ID        2-00000008  I*4  ILEN            2-0000000C  I*4  IWAIT               **      I*4  STATUS_C      


FUNCTIONS AND SUBROUTINES REFERENCED

  Type  Name            Type  Name            Type  Name            Type  Name            Type  Name            Type  Name          

        LIB$SIGNAL       I*4  LIO$ATTACH       I*4  LIO$DETACH       I*4  LIO$SET_I        I*4  LIO$SET_R        I*4  LIO$SHOW      


COMMAND QUALIFIERS

  FOR/LIS/EXTEND ADDA_DEFINE

  /CHECK=(NOBOUNDS,OVERFLOW,NOUNDERFLOW)
  /DEBUG=(NOSYMBOLS,TRACEBACK)
  /DESIGN=(NOCOMMENTS,NOPLACEHOLDERS)
  /SHOW=(NODICTIONARY,NOINCLUDE,MAP,NOPREPROCESSOR,SINGLE)
  /STANDARD=(NOSEMANTIC,NOSOURCE_FORM,NOSYNTAX)
  /WARNINGS=(NODECLARATIONS,GENERAL,NOULTRIX,NOVAXELN)
  /CONTINUATIONS=19  /NOCROSS_REFERENCE  /NOD_LINES  /EXTEND_SOURCE
  /F77  /NOG_FLOATING  /I4  /NOMACHINE_CODE  /OPTIMIZE  /NOPARALLEL
  /NOANALYSIS_DATA
  /NODIAGNOSTICS
  /LIST=LIB4:[ADDASYS.SOURCE]ADDA_DEFINE.LIS;22                                                             
  /OBJECT=LIB4:[ADDASYS.SOURCE]ADDA_DEFINE.OBJ;1                                                              

DET_CLOCK                                                       20-Nov-1990 18:09:02	VAX FORTRAN V5.4-79                 Page  15
01                                                              14-Jul-1988 19:37:13	LIB4:[ADDASYS.SOURCE]ADDA_DEFINE.FOR;5      

COMPILATION STATISTICS

  Run Time:           17.64 seconds
  Elapsed Time:       19.99 seconds
  Page Faults:        1290
  Dynamic Memory:     812 pages
