SUBROUTINE Extract_ADC(Chan,Offset,Slope,OutArray) c Subroutine to extract one ADC channel's data into a local array c Adjusts for 40/80 samples - 80 are avg'd down to 40, and c converted to floating point volts c Inputs are ADC chan (1-80), slope & offset c Output is Real array of 40 voltage values IMPLICIT none INCLUDE "FastCom.ftni" C Passed parameters INTEGER Chan REAL Slope, Offset, OutArray(40) C Local storage INTEGER idx, i, j, Cnt_lcl, Ptr_lcl INTEGER*2 SingInt(2) ! 2 16-bit #s INTEGER*4 DblInt ! convert to 1 32-bit EQUIVALENCE (SingInt,DblInt) C Start by setting up for selected ADC Channel Cnt_lcl = Ana_Size(Chan) ! # of bursts Ptr_lcl = Ana_Start(Chan) C move the data - two methods for 40/80 IF (Cnt_lcl.EQ.80) THEN ! only if 80 is explicit DO i = 1,40 OutArray(i) = (Float(IB(Ptr_lcl)) + & Float(IB(Ptr_lcl+1)))/2. * .000305 Ptr_lcl = Ptr_lcl + 2 ! since we handled 2 words OutArray(i) = OutArray(i) * Slope + Offset ! cnvt to mBar END DO ELSE ! default to 40 samples DO i = 1,40 OutArray(i) = Float(IB(Ptr_lcl)) * .000305 Ptr_lcl = Ptr_lcl + 1 ! bump to next input word OutArray(i) = OutArray(i) * Slope + Offset ! cnvt to mBar END DO ENDIF RETURN END