1 |
kusanagi |
1.1 |
|
2 |
|
|
C------------------------------------------------
|
3 |
|
|
SUBROUTINE CALPULSE(vect,ERROR,CAL_PULSE)
|
4 |
|
|
C------------------------------------------------
|
5 |
|
|
|
6 |
|
|
IMPLICIT NONE
|
7 |
|
|
C
|
8 |
|
|
C Normal variables definition
|
9 |
|
|
C
|
10 |
|
|
INTEGER ERROR
|
11 |
|
|
C
|
12 |
|
|
INTEGER i, j, ival
|
13 |
|
|
C
|
14 |
|
|
INTEGER*2 VECT(20000)
|
15 |
|
|
C
|
16 |
|
|
integer*2 check, crc
|
17 |
|
|
C
|
18 |
|
|
INTEGER ic, k, ke
|
19 |
|
|
INTEGER status
|
20 |
|
|
INTEGER inf, sup
|
21 |
|
|
INTEGER XO, YO, XE, YE
|
22 |
|
|
|
23 |
|
|
|
24 |
|
|
INTEGER*2 length, length2
|
25 |
|
|
|
26 |
|
|
INTEGER*2 st1, st2
|
27 |
|
|
|
28 |
|
|
REAL CAL_PULSE(4,11,96),
|
29 |
|
|
|
30 |
|
|
DATA XO/177/ ! CODE_DSP_R XO = 101 10001
|
31 |
|
|
DATA YO/173/ ! CODE_DSP_R YO = 101 01101
|
32 |
|
|
DATA XE/170/ ! CODE_DSP_R XE = 101 01010
|
33 |
|
|
DATA YE/182/ ! CODE_DSP_R YE = 101 10110
|
34 |
|
|
|
35 |
|
|
C
|
36 |
|
|
C Begin !
|
37 |
|
|
C
|
38 |
|
|
ERROR = 0
|
39 |
|
|
ival = 0
|
40 |
|
|
C
|
41 |
|
|
ic = 0
|
42 |
|
|
c
|
43 |
|
|
length = ic
|
44 |
|
|
do k = 1,4
|
45 |
|
|
ic = ic + length + 1
|
46 |
|
|
ke = 0
|
47 |
|
|
do while (ke = 0)
|
48 |
|
|
C
|
49 |
|
|
C Check consistency of status word.
|
50 |
|
|
C
|
51 |
|
|
st1 = IAND(vect(ic),'00FF'x)
|
52 |
|
|
if (st1.ne.0) then
|
53 |
|
|
write (*,10) k,vect(ic)
|
54 |
|
|
endif
|
55 |
|
|
st2 = IAND(vect(ic),'FF00'x)
|
56 |
|
|
status = ISHFT(st2,-8)
|
57 |
|
|
C
|
58 |
|
|
if (k.eq.1) then
|
59 |
|
|
if (status.eq.YE) then
|
60 |
|
|
ke = 1
|
61 |
|
|
else
|
62 |
|
|
write (*,11) k,vect(ic)
|
63 |
|
|
ERROR = 1
|
64 |
|
|
endif
|
65 |
|
|
if (status.eq.YO.or.status.eq.XE.or.status.eq.XO) then
|
66 |
|
|
write (*,12) k
|
67 |
|
|
length = -1
|
68 |
|
|
goto 50
|
69 |
|
|
endif
|
70 |
|
|
endif
|
71 |
|
|
C
|
72 |
|
|
if (k.eq.2) then
|
73 |
|
|
if (status.eq.YO) then
|
74 |
|
|
ke = 1
|
75 |
|
|
else
|
76 |
|
|
write (*,11) k,vect(ic)
|
77 |
|
|
ERROR = 1
|
78 |
|
|
endif
|
79 |
|
|
if (status.eq.YE.or.status.eq.XE.or.status.eq.XO) then
|
80 |
|
|
write (*,12) k
|
81 |
|
|
length = -1
|
82 |
|
|
goto 50
|
83 |
|
|
endif
|
84 |
|
|
endif
|
85 |
|
|
C
|
86 |
|
|
if (k.eq.3) then
|
87 |
|
|
if (status.eq.XE) then
|
88 |
|
|
ke = 1
|
89 |
|
|
else
|
90 |
|
|
write (*,11) k,vect(ic)
|
91 |
|
|
ERROR = 1
|
92 |
|
|
endif
|
93 |
|
|
if (status.eq.XO.or.status.eq.YO.or.status.eq.YE) then
|
94 |
|
|
write (*,12) k
|
95 |
|
|
length = -1
|
96 |
|
|
goto 50
|
97 |
|
|
endif
|
98 |
|
|
endif
|
99 |
|
|
C
|
100 |
|
|
if (k.eq.4) then
|
101 |
|
|
if (status.eq.XO) then
|
102 |
|
|
ke = 1
|
103 |
|
|
else
|
104 |
|
|
write (*,11) k,vect(ic)
|
105 |
|
|
ERROR = 1
|
106 |
|
|
endif
|
107 |
|
|
endif
|
108 |
|
|
C
|
109 |
|
|
ic = ic + 1
|
110 |
|
|
if (ic.gt.20000) then
|
111 |
|
|
write (*,13)
|
112 |
|
|
ERROR = 1
|
113 |
|
|
goto 100
|
114 |
|
|
endif
|
115 |
|
|
enddo
|
116 |
|
|
C
|
117 |
|
|
10 FORMAT(2X,'Error for view:',2X,I1,2X,'Status word:',2X,Z4)
|
118 |
|
|
11 FORMAT(2X,'View or command not recognized for view:',2X,I1,2X,
|
119 |
|
|
& 'Status word:',2X,Z4)
|
120 |
|
|
12 FORMAT(2X,'Error - did NOT find view:',2X,I1)
|
121 |
|
|
13 FORMAT(2X,'Error - eof reached, exiting')
|
122 |
|
|
C
|
123 |
|
|
C ic = ic + 1
|
124 |
|
|
length = length + (vect(ic) + 2)
|
125 |
|
|
length2 = vect(ic)
|
126 |
|
|
C
|
127 |
|
|
C Check validity of length.
|
128 |
|
|
C
|
129 |
|
|
if (vect(ic).ne.1057) then
|
130 |
|
|
print *,'problems with view',k
|
131 |
|
|
ERROR = 1
|
132 |
|
|
goto 50
|
133 |
|
|
endif
|
134 |
|
|
C
|
135 |
|
|
C Check consistency of CRC.
|
136 |
|
|
C
|
137 |
|
|
check = 0.
|
138 |
|
|
inf = (length-length2-2)+1
|
139 |
|
|
sup = length - 1
|
140 |
|
|
do i = inf,sup
|
141 |
|
|
check=crc(check,vect(i))
|
142 |
|
|
enddo
|
143 |
|
|
if (check.ne.vect(length)) then
|
144 |
|
|
print *,'Problems with CRC of view:',k
|
145 |
|
|
ERROR = 1
|
146 |
|
|
goto 50
|
147 |
|
|
endif
|
148 |
|
|
C
|
149 |
|
|
C Process data.
|
150 |
|
|
C
|
151 |
|
|
do j = 1,96
|
152 |
|
|
do i = 1,11
|
153 |
|
|
ic = ic + 1
|
154 |
|
|
cal_pulse(k,i,j) = vect(ic)
|
155 |
|
|
enddo
|
156 |
|
|
enddo
|
157 |
|
|
c
|
158 |
|
|
50 continue
|
159 |
|
|
c
|
160 |
|
|
enddo
|
161 |
|
|
C
|
162 |
|
|
100 continue
|
163 |
|
|
C
|
164 |
|
|
RETURN
|
165 |
|
|
END
|
166 |
|
|
|
167 |
|
|
|