20-Nov-1990 18:08:03 VAX FORTRAN V5.4-79 Page 1 6-Jul-1990 16:57:32 LIB4:[ADDASYS.SOURCE]ADDA_MAINIO.FOR;31 0001 OPTIONS/EXTEND 0002 PROGRAM ADDA_MAINIO 0003 C 0004 C ************************************************************************** 0005 C ** PROGRAM AUTHOR: WILLIAM BAKER 0006 C 0007 C ** PROGRAM DESCRIPTION: PROGRAM FOR CONTROL OF AXV11C AD/DA MODULES. 0008 C ** PROGRAM PERFORMS IO TO BOARDS AND STORES DATA. 0009 C 0010 C ** ADDA_MAINIO.FOR 0011 C ----------------------- 0012 C=========================================================================== 0013 C 0014 C ** DECLARE LOCAL VARIABLES... 0015 C 0016 INTEGER*4 STATUS_1, STATUS_C, AD_PREV, CEFN, LGRLEN, 0017 & STATUS_H, DELTA(2), TIMER_EF, CLKEFN 0018 C 0019 CHARACTER SECONDS*5, MINUTE*2, LGRVAL*3 0020 CHARACTER*99 DLINE, AD_IN, LOGLINE 0021 C 0022 C ** INCLUDE LABSTAR PARAMETERS 0023 C 0024 INCLUDE 'SYS$SHARE:LIOSET.FOR' 0713 C 0714 C ** INCLUDE SHARED COMMON USED BY THIS ENVIRONMENT 0715 C 0716 INCLUDE 'LIB4:[ADDASYS.SOURCE]ADDA_DATA_SHR.INC/LIST' 0717 1 C 0718 1 C ************************************************************************** 0719 1 C ** PROGRAM AUTHOR: WILLIAM BAKER 0720 1 C 0721 1 C ** PROGRAM DESCRIPTION: DEFINES AN AREA OF SHARED COMMON FOR USE BY 0722 1 C ** A/D AND D/A DATA ACQUISITION PROGRAMS. 0723 1 C 0724 1 C ** ADDA_SHR.FOR DICTIONARY 0725 1 C ----------------------- 0726 1 C 0727 1 C ** DEFINE THE STRUCTURE OF THE A/D CHANNEL LIST INFORMATION RECORD. 0728 1 C 0729 1 STRUCTURE /AD_LIST/ 0730 1 UNION 0731 1 MAP 0732 1 INTEGER*4 CHAN_NUM 0733 1 INTEGER*4 CHAN_GAIN 0734 1 CHARACTER*72 CHAN_DSCR 0735 1 END MAP 0736 1 END UNION 0737 1 END STRUCTURE 0738 1 C 0739 1 C ** DEFINE THE STRUCTURE OF THE D/A CHANNEL LIST INFORMATION RECORD. 0740 1 C 0741 1 STRUCTURE /DA_LIST/ 0742 1 UNION 0743 1 MAP 0744 1 INTEGER*4 CHAN_NUM 0745 1 CHARACTER*72 CHAN_DSCR ADDA_MAINIO 20-Nov-1990 18:08:03 VAX FORTRAN V5.4-79 Page 2 6-Jul-1990 16:57:32 LIB4:[ADDASYS.SOURCE]ADDA_MAINIO.FOR;31 0746 1 INTEGER*4 CHAN_DEVICE 0747 1 INTEGER*4 CHAN_FROM 0748 1 END MAP 0749 1 END UNION 0750 1 END STRUCTURE 0751 1 C 0752 1 C ** DECLARE THE A/D CHANNEL RECORD ARRAYS. 0753 1 C 0754 1 RECORD /AD_LIST/ AD_CHNL(2,16) 0755 1 C 0756 1 C ** DECLARE THE D/A CHANNEL RECORD ARRAYS. 0757 1 C 0758 1 RECORD /DA_LIST/ DA_CHNL(2,2) 0759 1 C 0760 1 C ** DECLARE PARAMETERS FOR EVENT FLAG STATUS. 0761 1 C 0762 1 PARAMETER SS$_WASCLR = '00000001'X 0763 1 PARAMETER SS$_WASSET = '00000009'X 0764 1 C 0765 1 C ** DELCARE LOGICALS USED FOR DETERMINING STATUS OF ACTIVITY. 0766 1 C 0767 1 LOGICAL START_STOP1, USE_LOGICAL1 0768 1 LOGICAL USE_LOGICAL8 0769 1 LOGICAL USE_LOGICAL9 0770 1 LOGICAL START_STOP2, USE_LOGICAL2, CLK_READY 0771 1 C 0772 1 C ** DECLARE SYSTEM SERVICE INTEGER FUNCTIONS. 0773 1 C 0774 1 INTEGER*4 SYS$CREMBX, SYS$DELMBX, SYS$DASSGN 0775 1 INTEGER*4 SYS$WAITFR, SYS$SETIMR, SYS$BINTIM, SYS$DLCEFC 0776 1 INTEGER*4 SYS$CLREF, SYS$ASCEFC, SYS$DACEFC, SYS$SETEF 0777 1 C 0778 1 C ** DECLARE ARRAYS WHICH CONTAIN COUNTS OF NUMBER OF CHANNELS IN USE. 0779 1 C 0780 1 INTEGER*4 AD_NUMBR(2), DA_NUMBR(2) 0781 1 C 0782 1 C ** DECLARE THE CLOCK RATE FOR THIS TEST. 0783 1 C 0784 1 REAL*4 CLK_RATE 0785 1 C 0786 1 C ** DECLARE THE POINTERS FOR THE ARRAYS ASSOCIATED WITH EACH DEVICE. 0787 1 C 0788 1 INTEGER*4 PRV_PNTR1, CUR_PNTR1, AD1_PNTR 0789 1 INTEGER*4 PRV_PNTR2, CUR_PNTR2, AD2_PNTR 0790 1 INTEGER*4 AD8_PNTR, AD9_PNTR 0791 1 C 0792 1 C ** DECLARE VARIABLE FOR CURRENT TIME ON SYSTEM. 0793 1 C 0794 1 INTEGER*4 CUR_TIME 0795 1 C 0796 1 C ** DECLARE VARIABLE FOR PLACEMENT OF NEW OPERATING INSTRUCTIONS CODE. 0797 1 C 0798 1 INTEGER*4 NEWOPT 0799 1 C 0800 1 C ** STORAGE ARRAYS FOR AXA0 DEVICE. 0801 1 C 0802 1 INTEGER*2 AD1_DATA1(120,16), AD1_DATA2(120,16) ADDA_MAINIO 20-Nov-1990 18:08:03 VAX FORTRAN V5.4-79 Page 3 6-Jul-1990 16:57:32 LIB4:[ADDASYS.SOURCE]ADDA_MAINIO.FOR;31 0803 1 INTEGER*4 AD1_TIME1(120), AD1_TIME2(120) 0804 1 C 0805 1 C ** BUFFERS FOR AXA0 I/O 0806 1 C 0807 1 INTEGER*2 AD1_BUFFER(16), DA1_BUFFER(2) 0808 1 C 0809 1 C ** STORAGE ARRAYS FOR AXB0 DEVICE. 0810 1 C 0811 1 INTEGER*2 AD2_DATA1(120,16), AD2_DATA2(120,16) 0812 1 INTEGER*4 AD2_TIME1(120), AD2_TIME2(120) 0813 1 C 0814 1 C ** BUFFERS FOR AXB0 I/O 0815 1 C 0816 1 INTEGER*2 AD2_BUFFER(16), DA2_BUFFER(2) 0817 1 C 0818 1 C ** STORAGE ARRAYS FOR POST TEST DATA ANALYSIS OF DATA. 0819 1 C 0820 1 INTEGER*2 AD8_DATA1(120,16), AD9_DATA1(120,16) 0821 1 INTEGER*4 AD8_TIME1(120), AD9_TIME1(120) 0822 1 C 0823 1 C*************************************************************************** 0824 1 C 0825 1 C ** DECLARES THE SHARED COMMON. 0826 1 C 0827 1 COMMON /ADDA_DATA/ AD1_DATA1, AD1_DATA2, AD1_BUFFER, DA1_BUFFER, 0828 1 & AD1_TIME1, AD1_TIME2, 0829 1 & AD2_DATA1, AD2_DATA2, AD2_BUFFER, DA2_BUFFER, 0830 1 & AD2_TIME1, AD2_TIME2 0831 1 C 0832 1 COMMON /ADDA_STORE/ AD8_DATA1, AD8_TIME1, AD8_PNTR, USE_LOGICAL8, 0833 1 & AD9_DATA1, AD9_TIME1, AD9_PNTR, USE_LOGICAL9 0834 1 C 0835 1 COMMON /ADDA_PNTRS/ PRV_PNTR1, CUR_PNTR1, AD1_PNTR, 0836 1 & PRV_PNTR2, CUR_PNTR2, AD2_PNTR 0837 1 C 0838 1 COMMON /ADDA_LOGIC/ START_STOP1, USE_LOGICAL1, START_STOP2, 0839 1 & USE_LOGICAL2, CLK_READY 0840 1 C 0841 1 COMMON /ADDA_NMBR/ CLK_RATE, AD_NUMBR, DA_NUMBR, NEWOPT, CUR_TIME, 0842 1 & AD_CHNL, DA_CHNL 0843 1 C 0844 1 C************************************************ 0845 1 C 0846 1 C ** DECLARE FOLLOWING ROUTINES AS EXTERNAL TO NORMAL PROGRAM. 0847 1 C 0848 1 EXTERNAL SYS$CREMBX 0849 1 EXTERNAL SYS$DELMBX 0850 1 EXTERNAL SYS$DASSGN 0851 1 EXTERNAL SYS$WAITFR 0852 1 EXTERNAL SYS$SETEF 0853 1 EXTERNAL SYS$DACEFC 0854 1 EXTERNAL SYS$DLCEFC 0855 1 EXTERNAL SYS$ASCEFC 0856 1 EXTERNAL SYS$CLREF 0857 1 C 0858 C 0859 C ** INCLUDE COMMON DECLARATION FOR MAPPING SETTINGS ADDA_MAINIO 20-Nov-1990 18:08:03 VAX FORTRAN V5.4-79 Page 4 6-Jul-1990 16:57:32 LIB4:[ADDASYS.SOURCE]ADDA_MAINIO.FOR;31 0860 C 0861 INCLUDE 'LIB4:[ADDASYS.SOURCE]ADDA_DATA_MAP.INC' 0905 C 0906 C ** DECLARE AST ROUTINE FOR GATHERING DATA 0907 C 0908 EXTERNAL AX_AST 0909 C 0910 C ** DEFINE THE DEVICE BEING CONTROLLED BY THIS IO ROUTINE 0911 C 0912 CALL LIB$GET_FOREIGN(AD_IN,'String: ',LEN_AD) 0913 CALL STR$TRIM(AD_IN, AD_IN(1:LEN_AD), LEN_AD) 0914 C 0915 DECODE(LEN_AD,750,AD_IN) IDV 0916 750 FORMAT(I) 0917 C 0918 IF (IDV .EQ. 1) THEN 0919 DEVICE = 'AXA0' 0920 ELSE 0921 DEVICE = 'AXB0' 0922 ENDIF 0923 C 0924 C ** OPEN UP ACCESS TO EVENT FLAG CLUSTER. 0925 C 0926 CEFN = 64 0927 C 0928 STATUS_H = SYS$ASCEFC( %VAL(CEFN), 'ADDA_DATA_GET', , ) 0929 IF (.NOT. STATUS_H) CALL LIB$SIGNAL(%VAL(STATUS_H)) 0930 C 0931 C ** INITIALIZE IO PROGRAM 0932 C 0933 1000 CALL ADDA_INIT 0934 C 0935 C ** SET DATA LOGGING FLAG, BASED UPON USER REQUEST, DEFAULT IS LOGGING ENABLED. 0936 C 0937 LOGLINE = 'ADDA$DATALOG_'//DEVICE(1:4)//' ' 0938 CALL STR$TRIM( LOGLINE, LOGLINE, LLOK ) 0939 C 0940 STATUS_H = LIB$SYS_TRNLOG( LOGLINE(1:LLOK), LGRLEN, LGRVAL ) 0941 IF (.NOT. STATUS_H) CALL LIB$SIGNAL(%VAL(STATUS_H)) 0942 C 0943 LOG_DATA_OK = .TRUE. 0944 IF ((STATUS_H) .AND. (LGRVAL(1:LGRLEN) .EQ. 'NO')) THEN 0945 LOG_DATA_OK = .FALSE. 0946 TYPE *, 'Data Logger Set to OFF: ',LOGLINE(1:LLOK) 0947 ELSE 0948 TYPE *, 'Data Logger Set to ON: ',LOGLINE(1:LLOK) 0949 ENDIF 0950 C 0951 C ** MAP THE VARIABLES FOR THE DEVICE TO BE CONTROLLED. 0952 C 0953 CALL ADDA_MAP 0954 C 0955 C ** ATTACH THE AXV11C MODULE. 0956 C 0957 TYPE *, 'Attach device # ',idv 0958 STATUS_1 = LIO$ATTACH( AD_ID, DEVICE, LIO$K_QIO ) 0959 IF (.NOT. (STATUS_1)) CALL LIB$SIGNAL(%VAL(STATUS_1)) ADDA_MAINIO 20-Nov-1990 18:08:03 VAX FORTRAN V5.4-79 Page 5 6-Jul-1990 16:57:32 LIB4:[ADDASYS.SOURCE]ADDA_MAINIO.FOR;31 0960 C 0961 C ** SET UP THE AXV11C MODULE. 0962 C 0963 TYPE *, 'Set up the AXV11.' 0964 IF (DA_NMBR .EQ. 0) THEN 0965 STATUS_1 = LIO$SET_I( AD_ID, LIO$K_AST_RTN, 1, AX_AST ) 0966 IF (.NOT. (STATUS_1)) CALL LIB$SIGNAL(%VAL(STATUS_1)) 0967 ENDIF 0968 C 0969 C ** DECLARE INTERFACE TO BE ASYNCHRONOUS. 0970 C 0971 STATUS_1 = LIO$SET_I( AD_ID, LIO$K_ASYNCH, 0 ) 0972 IF (.NOT. (STATUS_1)) CALL LIB$SIGNAL(%VAL(STATUS_1)) 0973 C 0974 TYPE *, 'Set Trigger Type' 0975 C 0976 C ** DEFINE THE TRIGGER TYPE 0977 C 0978 STATUS_1 = LIO$SET_I( AD_ID, LIO$K_TRIG, 1, LIO$K_CLK_SWEEP ) 0979 IF (.NOT. (STATUS_1)) CALL LIB$SIGNAL(%VAL(STATUS_1)) 0980 C 0981 C ** DEFINE THE A/D CHANNELS TO BE USED THIS IO SESSION. 0982 C 0983 TYPE *, 'Set up Channel Definitions.', Device 0984 IF (AD_NMBR .NE. 0) THEN 0985 TYPE *, 'Set up Channel Definitions.', Device 0986 CALL AD_CHNL_DEF( AD_ID, AD_NMBR, AD_CHAN, AD_GAIN ) 0987 ENDIF 0988 C 0989 IF (DA_NMBR .NE. 0) THEN 0990 C 0991 C ** SET UP THE AXV11C D/A MODULE. 0992 C 0993 TYPE *, 'Set up D/A Channel Definitions.', Device 0994 CALL DA_CHNL_DEF( AD_ID, DA_NMBR, DA_CHAN ) 0995 C 0996 ENDIF 0997 C 0998 C ** WAIT TIL CLOCK INTERFACE IS READY. 0999 C 1000 DO WHILE (.NOT. CLK_READY) 1001 CALL WAITABIT( 0.1 ) 1002 ENDDO 1003 C 1004 C ** TELL CLOCK THAT THIS DEVICE IO PROGRAM IS READY TO ENQUEUE 1005 C 1006 CLKEFN = 90 + IDV 1007 TYPE *,'Setting the Clock Event Flag = ',CLKEFN 1008 CALL SYS$SETEF( %VAL(CLKEFN) ) 1009 C 1010 C ** WAIT TIL CLOCK INTERFACE IS READY. 1011 C 1012 DO WHILE (.NOT. CLK_READY) 1013 CALL WAITABIT( 0.1 ) 1014 ENDDO 1015 C 1016 C*** ADDA_MAINIO 20-Nov-1990 18:08:03 VAX FORTRAN V5.4-79 Page 6 6-Jul-1990 16:57:32 LIB4:[ADDASYS.SOURCE]ADDA_MAINIO.FOR;31 1017 C SLEEP TILL PROCESS STARTED BY USER PROGRAM. 1018 C*** 1019 C 1020 C IOP = 0, KEEP GOING, GET DATA. 1021 C IOP = 1, RESET CONFIGURATION. 1022 C IOP = 2, STOP GATHERING, AND RE-CONFIGURE. 1023 C IOP = 3, STOP GATHERING, AND STOP PROGRAMS. 1024 C 1025 IOP = 0 1026 ISETEFN = 0 1027 TYPE *, SS$_WASSET, SS$_WASCLR 1028 C 1029 TYPE *, 'GOING TO SLEEP NOW, WAITING FOR COMMAND TO START.' 1030 C 1031 C ** WAITING UNTIL START SIGNAL HAS BEEN GIVEN BY THE CONTROL PROGRAM. 1032 C 1033 DO WHILE ( ISETEFN .NE. SS$_WASSET ) 1034 C 1035 CALL ADDA_SLEEP( IOP, ISETEFN, IDV ) 1036 IF ( ISETEFN .NE. SS$_WASSET ) CALL WAITABIT( 1.0 ) 1037 C 1038 ENDDO 1039 C 1040 C ** BRANCH BACK TO TOP OF PROGRAM AND RE-INITIALIZE VARIABLES. 1041 C 1042 TYPE *, 'I WOKE UP, AND THE COMMAND WAS = ',IOP 1043 IF ( IOP .EQ. 1 ) GOTO 2000 1044 C 1045 C ** WAIT TIL CLOCK INTERFACE IS READY. 1046 C 1047 DO WHILE (.NOT. CLK_READY) 1048 CALL WAITABIT( 0.1 ) 1049 ENDDO 1050 C 1051 C*** 1052 C START THE I/O TO THE AXV11C MODULES. 1053 C 1054 INIT_ENQ = 0 1055 CALL AD_ENQS( AD_ID, AD_NMBR, AD_BUFFER, AD_EFN, INIT_ENQ ) 1056 C 1057 C TELL THE CLOCK TO RESTART. 1058 C*** 1059 C 1060 CLKEFN = 90 1061 TYPE *,'Setting the Clock Event Flag = ',CLKEFN 1062 CALL SYS$SETEF( %VAL(CLKEFN) ) 1063 C 1064 C ** WAIT TIL CLOCK INTERFACE IS READY. 1065 C 1066 DO WHILE (.NOT. CLK_READY) 1067 CALL WAITABIT( 0.1 ) 1068 ENDDO 1069 TYPE *,'Clock Started.' 1070 C 1071 C ** IF THE D/A CHANNELS HAVE BEEN DEFINED THEN WE WILL REMAIN ACTIVE 1072 C ** WHILE THE DATA IS BEING GATHERED. THIS WAY WE CAN PUSH DATA OUT 1073 C ** THE D/A PORTS WHEN IT IS POSTED. ADDA_MAINIO 20-Nov-1990 18:08:03 VAX FORTRAN V5.4-79 Page 7 6-Jul-1990 16:57:32 LIB4:[ADDASYS.SOURCE]ADDA_MAINIO.FOR;31 1074 C 1075 IF (DA_NMBR .NE. 0) THEN 1076 C 1077 C*** CONTINUE I/O TO THE AXV11C MODULES. 1078 C 1079 INIT_ENQ = -9 1080 CALL AD_ENQS( AD_ID, AD_NMBR, AD_BUFFER, AD_EFN, INIT_ENQ ) 1081 C 1082 C ** FIRST LETS DEFINE THE WAIT INTERVAL BETWEEN POSTING D/A DATA. 1083 C 1084 USE_LOGICAL = .TRUE. 1085 RSEC = 1/(CLK_RATE*1.01) 1086 IF (RSEC .LT. 1.0) THEN 1087 ENCODE(4,8000,SECONDS) RSEC 1088 8000 FORMAT(F4.2) 1089 STATUS_H = SYS$BINTIM('0 00:00:'//SECONDS,DELTA) 1090 ELSE IF (RSEC .LT. 60.0) THEN 1091 ENCODE(5,8010,SECONDS) RSEC 1092 8010 FORMAT(F5.2) 1093 STATUS_H = SYS$BINTIM('0 00:00:'//SECONDS,DELTA) 1094 ELSE 1095 IMINUTE = RSEC/60 1096 RSEC = RSEC - (IMINUTE * 60.0) 1097 ENCODE(5,8020,SECONDS) RSEC 1098 8020 FORMAT(F5.2) 1099 ENCODE(2,8030,MINUTE) IMINUTE 1100 8030 FORMAT(I2) 1101 STATUS_H = SYS$BINTIM('0 00:'//MINUTE//':'//SECONDS,DELTA) 1102 ENDIF 1103 C 1104 C*** CHANGE TIME VARIABLE TO DELTA TIME VALUES. 1105 C 1106 DELTA(1) = -DELTA(1) 1107 DELTA(2) = -DELTA(2) 1108 C 1109 C ** NOW START LOOPING, EACH PASS WE UPDATE THE D/A PORTS WITH KNOWN DATA 1110 C ** EITHER POSTED FROM A/D PORTS OR FROM A USER PROGRAM. THEN WE SLEEP. 1111 C 1112 AD_PREV = 0 1113 C 1114 IF (IDV .EQ. 1) THEN 1115 DO WHILE (.NOT. START_STOP1) 1116 C 1117 C ** PERFORM THE I/O TO THE AXA0 MODULE. 1118 C 1119 IF (AD_NMBR .NE. 0) THEN 1120 CALL ASYNCH_IN 1121 ELSE 1122 AD1_PNTR = AD1_PNTR + 1 1123 IF (AD1_PNTR .GT. 120) AD1_PNTR = 1 1124 ENDIF 1125 IF (AD_PREV .NE. AD1_PNTR) THEN 1126 AD_PREV = AD1_PNTR 1127 CALL ASYNCH_OUT 1128 C IF (AD_NMBR .EQ. 0) THEN 1129 STATUS_H = SYS$SETIMR(%VAL(TIMER_EF),DELTA,,) 1130 STATUS_H = SYS$WAITFR(%VAL(TIMER_EF)) ADDA_MAINIO 20-Nov-1990 18:08:03 VAX FORTRAN V5.4-79 Page 8 6-Jul-1990 16:57:32 LIB4:[ADDASYS.SOURCE]ADDA_MAINIO.FOR;31 1131 C ENDIF 1132 ENDIF 1133 ENDDO 1134 C 1135 ELSE IF (IDV .EQ. 2) THEN 1136 DO WHILE (.NOT. START_STOP2) 1137 C 1138 C ** PERMFORM THE I/O TO THE AXB0 MODULE. 1139 C 1140 IF (AD_NMBR .NE. 0) THEN 1141 CALL ASYNCH_IN 1142 ELSE 1143 AD2_PNTR = AD2_PNTR + 1 1144 IF (AD2_PNTR .GT. 120) AD2_PNTR = 1 1145 ENDIF 1146 IF (AD_PREV .NE. AD2_PNTR) THEN 1147 AD_PREV = AD2_PNTR 1148 CALL ASYNCH_OUT 1149 C IF (AD_NMBR .EQ. 0) THEN 1150 STATUS_H = SYS$SETIMR(%VAL(TIMER_EF),DELTA,,) 1151 STATUS_H = SYS$WAITFR(%VAL(TIMER_EF)) 1152 C ENDIF 1153 ENDIF 1154 ENDDO 1155 ENDIF 1156 IOP = NEWOPT 1157 C 1158 ELSE 1159 C 1160 C ** HERE WE PLACE THE PROGRAM IN A SLEEP LOOP. WE CHECK THE EVENT 1161 C ** FLAGS FOR THIS SESSIONS CONTROL OF DATA, THEN SLEEP FOR A SECOND 1162 C 1163 IOP = 0 1164 ISETEFN = 0 1165 TYPE *, 'Going to sleep... AST routines will take over...' 1166 C 1167 DO WHILE ( ISETEFN .NE. SS$_WASSET ) 1168 C 1169 CALL ADDA_SLEEP( IOP, ISETEFN, IDV ) 1170 IF ( ISETEFN .NE. SS$_WASSET ) CALL WAITABIT( 1.0 ) 1171 C 1172 ENDDO 1173 C 1174 ENDIF 1175 C 1176 C ** RESET THE VALUE OF THE LOGICALS FOR STARTING AND STOPPING OTHER PROGRAMS. 1177 C 1178 IF (IDV .EQ. 1) START_STOP1 = .TRUE. 1179 IF (IDV .EQ. 2) START_STOP2 = .TRUE. 1180 C 1181 TYPE *, 'I WOKE UP, AND THE COMMAND WAS = ',IOP 1182 TYPE *, 'TERMINATING THIS SECTION OF TEST...' 1183 C 1184 C ** WAIT A SECOND WHILE OTHER PROGRAMS CLEAR THEMSELVES. 1185 C 1186 CALL WAITABIT( 1.0 ) 1187 C ADDA_MAINIO 20-Nov-1990 18:08:03 VAX FORTRAN V5.4-79 Page 9 6-Jul-1990 16:57:32 LIB4:[ADDASYS.SOURCE]ADDA_MAINIO.FOR;31 1188 C*** 1189 C DETACH THE DEVICES FROM THE PROGRAM. 1190 C*** 1191 C 1192 2000 IRUN_DWN = 1 1193 TYPE *,' STOPPING DEVICE: ',IDV 1194 STATUS_1 = LIO$DETACH( AD_ID, ) 1195 IF (.NOT. (STATUS_1)) CALL LIB$SIGNAL(%VAL(STATUS_1)) 1196 C 1197 CALL WAITABIT( 1.0 ) 1198 C 1199 IF (IOP .GE. 2) THEN 1200 C 1201 C ** BEGIN FILING DATA STORED IN FILING PROGRAM. 1202 C 1203 TYPE *, ' FILING DATA...' 1204 IF ((AD_NMBR .NE. 0) .AND. (LOG_DATA_OK)) CALL FILE_DATA( DEVICE, IDV, CUR_PNTR1, IDV ) 1205 C 1206 ENDIF 1207 C 1208 TYPE *,' MORE DATA FILING AS NEEDED...', IOP 1209 C 1210 C ** NOW WE TELL THE FILER PROGRAM TO SHUTDOWN. 1211 C 1212 IF ((IOP .EQ. 1) .OR. (IOP .EQ. 2)) THEN 1213 IF ((AD_NMBR .NE. 0) .AND. (LOG_DATA_OK)) CALL FILE_DATA( DEVICE, IDV, 0, 3 ) 1214 GOTO 1000 1215 ELSE 1216 IF ((AD_NMBR .NE. 0) .AND. (LOG_DATA_OK)) CALL FILE_DATA( DEVICE, IDV, 0, 9 ) 1217 ENDIF 1218 C 1219 TYPE *,' BYE-BYE' 1220 C 1221 TYPE *, 'EXIT OF MAINIO PROGRAM...' 1222 C 1223 END ADDA_MAINIO 20-Nov-1990 18:08:03 VAX FORTRAN V5.4-79 Page 10 01 6-Jul-1990 16:57:32 LIB4:[ADDASYS.SOURCE]ADDA_MAINIO.FOR;31 PROGRAM SECTIONS Name Bytes Attributes 0 $CODE 2300 PIC CON REL LCL SHR EXE RD NOWRT LONG 1 $PDATA 576 PIC CON REL LCL SHR NOEXE RD NOWRT LONG 2 $LOCAL 1228 PIC CON REL LCL NOSHR NOEXE RD WRT LONG 3 ADDA_DATA 17352 PIC OVR REL GBL SHR NOEXE RD WRT LONG 4 ADDA_STORE 8656 PIC OVR REL GBL SHR NOEXE RD WRT LONG 5 ADDA_PNTRS 24 PIC OVR REL GBL SHR NOEXE RD WRT LONG 6 ADDA_LOGIC 20 PIC OVR REL GBL SHR NOEXE RD WRT LONG 7 ADDA_NMBR 2924 PIC OVR REL GBL SHR NOEXE RD WRT LONG 8 ADDA_MAP 228 PIC OVR REL GBL SHR NOEXE RD WRT LONG Total Space Allocated 33308 ENTRY POINTS Address Type Name 0-00000000 ADDA_MAINIO VARIABLES Address Type Name Address Type Name Address Type Name Address Type Name 5-00000008 I*4 AD1_PNTR 5-00000014 I*4 AD2_PNTR 4-000010E0 I*4 AD8_PNTR 4-000021C8 I*4 AD9_PNTR 8-000000B4 I*4 AD_EFN 8-000000A4 I*4 AD_ID 2-00000075 CHAR AD_IN 8-00000040 I*4 AD_NMBR 2-00000144 I*4 AD_PREV 8-000000A0 L*4 AD_STRT 2-00000148 I*4 CEFN 2-00000158 I*4 CLKEFN 8-000000A8 I*4 CLK_ID 7-00000000 R*4 CLK_RATE 6-00000010 L*4 CLK_READY 5-00000004 I*4 CUR_PNTR1 5-00000010 I*4 CUR_PNTR2 7-00000018 I*4 CUR_TIME 8-000000E0 I*4 DA_EFN 8-0000004C I*4 DA_NMBR 8-000000B0 CHAR DEVICE 2-00000012 CHAR DLINE 8-000000AC I*4 IDV 2-00000178 I*4 IMINUTE 2-0000016C I*4 INIT_ENQ 2-00000164 I*4 IOP 2-0000017C I*4 IRUN_DWN 2-00000168 I*4 ISETEFN 2-0000015C I*4 LEN_AD 2-0000014C I*4 LGRLEN 2-0000000F CHAR LGRVAL 2-00000160 I*4 LLOK 2-000000D8 CHAR LOGLINE 8-000000DC L*4 LOG_DATA_OK 2-0000000D CHAR MINUTE 7-00000014 I*4 NEWOPT 5-00000000 I*4 PRV_PNTR1 5-0000000C I*4 PRV_PNTR2 2-00000174 R*4 RSEC 2-00000008 CHAR SECONDS 6-00000000 L*4 START_STOP1 6-00000008 L*4 START_STOP2 2-0000013C I*4 STATUS_1 2-00000140 I*4 STATUS_C 2-00000150 I*4 STATUS_H 2-00000154 I*4 TIMER_EF 8-000000B8 L*4 USE_CLOCK 2-00000170 R*4 USE_LOGICAL 6-00000004 L*4 USE_LOGICAL1 6-0000000C L*4 USE_LOGICAL2 4-000010E4 L*4 USE_LOGICAL8 4-000021CC L*4 USE_LOGICAL9 ARRAYS Address Type Name Bytes Dimensions 3-00001E00 I*2 AD1_BUFFER 32 (16) 3-00000000 I*2 AD1_DATA1 3840 (120, 16) 3-00000F00 I*2 AD1_DATA2 3840 (120, 16) 3-00001E24 I*4 AD1_TIME1 480 (120) 3-00002004 I*4 AD1_TIME2 480 (120) 3-00003FE4 I*2 AD2_BUFFER 32 (16) 3-000021E4 I*2 AD2_DATA1 3840 (120, 16) 3-000030E4 I*2 AD2_DATA2 3840 (120, 16) 3-00004008 I*4 AD2_TIME1 480 (120) 3-000041E8 I*4 AD2_TIME2 480 (120) ADDA_MAINIO 20-Nov-1990 18:08:03 VAX FORTRAN V5.4-79 Page 11 01 6-Jul-1990 16:57:32 LIB4:[ADDASYS.SOURCE]ADDA_MAINIO.FOR;31 4-00000000 I*2 AD8_DATA1 3840 (120, 16) 4-00000F00 I*4 AD8_TIME1 480 (120) 4-000010E8 I*2 AD9_DATA1 3840 (120, 16) 4-00001FE8 I*4 AD9_TIME1 480 (120) 8-000000BC I*2 AD_BUFFER 32 (16) 8-00000000 I*4 AD_CHAN 64 (16) 8-00000050 I*4 AD_GAIN 64 (16) 7-00000004 I*4 AD_NUMBR 8 (2) 3-00001E20 I*2 DA1_BUFFER 4 (2) 3-00004004 I*2 DA2_BUFFER 4 (2) 8-00000044 I*4 DA_CHAN 8 (2) 8-00000098 I*4 DA_DEV 8 (2) 8-00000090 I*4 DA_FRM 8 (2) 7-0000000C I*4 DA_NUMBR 8 (2) 2-00000000 I*4 DELTA 8 (2) RECORD ARRAYS Address Name Structure Bytes Dimensions 7-0000001C AD_CHNL AD_LIST 2560 (2, 16) 7-00000A1C DA_CHNL DA_LIST 336 (2, 2) LABELS Address Label Address Label Address Label Address Label Address Label Address Label 1-00000216 750' 0-0000009A 1000 0-000007C4 2000 1-0000021D 8000' 1-00000221 8010' 1-00000225 8020' 1-00000229 8030' FUNCTIONS AND SUBROUTINES REFERENCED Type Name Type Name Type Name ADDA_INIT ADDA_MAP ADDA_SLEEP AD_CHNL_DEF AD_ENQS ASYNCH_IN ASYNCH_OUT AX_AST DA_CHNL_DEF FILE_DATA LIB$GET_FOREIGN LIB$SIGNAL I*4 LIB$SYS_TRNLOG I*4 LIO$ATTACH I*4 LIO$DETACH I*4 LIO$SET_I STR$TRIM I*4 SYS$ASCEFC I*4 SYS$BINTIM SYS$SETEF I*4 SYS$SETIMR I*4 SYS$WAITFR WAITABIT OPTIONS QUALIFIERS /CHECK=(NOBOUNDS,OVERFLOW,NOUNDERFLOW) /EXTEND_SOURCE /F77 /NOG_FLOATING /I4 20-Nov-1990 18:08:03 VAX FORTRAN V5.4-79 Page 12 6-Jul-1990 16:57:32 LIB4:[ADDASYS.SOURCE]ADDA_MAINIO.FOR;31 0002 OPTIONS/EXTEND 0003 SUBROUTINE AD_ENQS( DEVICE_ID, NCHNL, AD, AD_EFN, DA_NMBR ) 0004 C 0005 C ************************************************************************** 0006 C ** PROGRAM AUTHOR: WILLIAM BAKER 0007 C 0008 C ** PURPOSE IS TO ENQUEUE THE AXV11C DEVICE IN PREPARATION FOR 0009 C FOR DATA IO TO BE STARTED BY THE MAINIO PROGRAM. 0010 C 0011 C 0012 INTEGER*4 NCHNL, BUFF_LEN, DEVICE_ID, STATUS_1, AD_EFN, 0013 & DATA_LEN, DA_NMBR 0014 INTEGER*2 AD(NCHNL), BUFF_PTR 0015 C 0016 INCLUDE 'SYS$SHARE:LIOSET.FOR' 0705 C 0706 C ** DECLARE THE DATA BUFFER LENGTH. 0707 C 0708 BUFF_LEN = NCHNL * 2 0709 C 0710 IF (DA_NMBR .EQ. 0) TYPE *, 'START ENQUEUES. ' 0711 C 0712 C ** ISSUE THE ENQUEUE COMMAND. 0713 C 0714 IF (DA_NMBR .EQ. 0) THEN 0715 C 0716 C ** INITIAL ENQUEUE OF AXV11 DEVICE 0717 C ** AST ROUTINES WILL TAKE OVER UNDER MOST CIRCUMSTANCES, 0718 C ** OTHERWISE THE ELSE PORTION OF THIS IF STATEMENT APPLIES. 0719 C 0720 STATUS_1 = LIO$ENQUEUE( DEVICE_ID, AD, BUFF_LEN, , AD_EFN, , LIO$K_INPUT ) 0721 IF ( .NOT. STATUS_1 ) CALL LIB$SIGNAL(%VAL(STATUS_1)) 0722 C 0723 ELSE IF (DA_NMBR .LT. 0) THEN 0724 C 0725 C ** GET DATA FROM AXV11C DEVICE. 0726 C 0727 STATUS_1 = LIO$DEQUEUE( DEVICE_ID, BUFF_PTR, BUFF_LEN, DATA_LEN, 1, , ) 0728 IF ( .NOT. STATUS_1 ) CALL LIB$SIGNAL(%VAL(STATUS_1)) 0729 C 0730 ELSE 0731 C 0732 C ** ENQUEUE TO AXV11C DEVICE. 0733 C 0734 STATUS_1 = LIO$ENQUEUE( DEVICE_ID, AD, BUFF_LEN, , AD_EFN, , LIO$K_INPUT ) 0735 IF ( .NOT. STATUS_1 ) CALL LIB$SIGNAL(%VAL(STATUS_1)) 0736 C 0737 C ** GET DATA FROM AXV11C DEVICE. 0738 C 0739 STATUS_1 = LIO$DEQUEUE( DEVICE_ID, BUFF_PTR, BUFF_LEN, DATA_LEN, 1, , ) 0740 IF ( .NOT. STATUS_1 ) CALL LIB$SIGNAL(%VAL(STATUS_1)) 0741 C 0742 ENDIF 0743 C 0744 RETURN 0745 END AD_ENQS 20-Nov-1990 18:08:03 VAX FORTRAN V5.4-79 Page 13 01 6-Jul-1990 16:57:32 LIB4:[ADDASYS.SOURCE]ADDA_MAINIO.FOR;31 PROGRAM SECTIONS Name Bytes Attributes 0 $CODE 250 PIC CON REL LCL SHR EXE RD NOWRT LONG 1 $PDATA 24 PIC CON REL LCL SHR NOEXE RD NOWRT LONG 2 $LOCAL 224 PIC CON REL LCL NOSHR NOEXE RD WRT LONG Total Space Allocated 498 ENTRY POINTS Address Type Name 0-00000000 AD_ENQS VARIABLES Address Type Name Address Type Name Address Type Name Address Type Name AP-00000010@ I*4 AD_EFN 2-00000004 I*4 BUFF_LEN 2-00000000 I*2 BUFF_PTR 2-0000000C I*4 DATA_LEN AP-00000014@ I*4 DA_NMBR AP-00000004@ I*4 DEVICE_ID AP-00000008@ I*4 NCHNL 2-00000008 I*4 STATUS_1 ARRAYS Address Type Name Bytes Dimensions AP-0000000C@ I*2 AD ** (*) FUNCTIONS AND SUBROUTINES REFERENCED Type Name Type Name Type Name LIB$SIGNAL I*4 LIO$DEQUEUE I*4 LIO$ENQUEUE OPTIONS QUALIFIERS /CHECK=(NOBOUNDS,OVERFLOW,NOUNDERFLOW) /EXTEND_SOURCE /F77 /NOG_FLOATING /I4 AD_ENQS 20-Nov-1990 18:08:03 VAX FORTRAN V5.4-79 Page 14 01 6-Jul-1990 16:57:32 LIB4:[ADDASYS.SOURCE]ADDA_MAINIO.FOR;31 COMMAND QUALIFIERS FOR/LIS/NOOPT/EXTEND ADDA_MAINIO /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 /NOOPTIMIZE /NOPARALLEL /NOANALYSIS_DATA /NODIAGNOSTICS /LIST=LIB4:[ADDASYS.SOURCE]ADDA_MAINIO.LIS;23 /OBJECT=LIB4:[ADDASYS.SOURCE]ADDA_MAINIO.OBJ;1 COMPILATION STATISTICS Run Time: 15.10 seconds Elapsed Time: 17.61 seconds Page Faults: 1173 Dynamic Memory: 764 pages