C**********************************************************************
C
	SUBROUTINE IFSSCN( SANG,EANG,DANG,SPEED,TIMEL,COUNTL,WRCNT)
C
C	STEPSCAN A RANGE FROM SANG TO EANG
C
C	IF EANG.LT.0 THEN COUNT IABS(EANG) POINTS
C
C======================================================================
C
      INCLUDE 'COMMON.FTN'
      INCLUDE '[RADIX]INTERFACE.COM'
      LOGICAL FIRST
C Calls IFMOVE, STSCAN
C
C======================================================================
C
C   Assume scan will be sucessful.
	IFSTAT = 0
	KICK = 0
C
C======================================================================
C
C	STEP SCAN -- RETURN LOTS OF VALUES FOR COUNTS
C
C   Get number of points to look at.  Number of points is either
C   calculated, or equal to -EANG.
1000	NPTS = - INT(EANG)
	IF(NPTS.LT.0) NPTS = INT( (EANG-SANG) / DANG + 1.5)
C
C   Make sure what we are doing is reasonable.
	IF(NPTS.LT.0 .OR. DANG.LE.0.0 .OR. TIMEL.LE.0.0) GOTO 9000
C
C   Start the loop.  ANG is the current angle, IPT is the number of the point.
	ANGLE = SANG
	IPT = 1
C
C   Slew to first point
	CALL IFMOVE( SANG, SPSLEW)
C
	FIRST = .TRUE.
C
C   Loop to measure all points.
1100	 CALL STSCAN(COUNTS,FIRST,IFSTAT,NPTS,TIMEL,DANG,1,0)
	 IF( IFSTAT.LT.0) GOTO 9990
	 FIRST=.FALSE.
	 IF(IBUG.NE.0 .AND. NBUG(4).EQ.1) 
     &      WRITE(IBUG,1104) ANGLE, COUNTS, TMPRTR
1104	 FORMAT(' > ANGLE =',F8.4,'  COUNTS =',F8.0,'  TEMP = ',F8.4)
C
C   Store the counts
	 IFSTAT = 4
	 CALL WRCNT
C
C   Go do the next point.
	ANGLE = ANGLE + DANG
	IPT = IPT + 1
	IF(IPT.LE.NPTS) GOTO 1100
C
C   Finished all requested points.
C
	GOTO 9999
C
C======================================================================
C
C	ABNORMAL RETURNS
C
C   Invalid call parameters: neg # points or neg time.
9000	WRITE(IERR,9004) SANG*STPSIZ, EANG*STPSIZ,
     &    DANG*STPSIZ, TIMEL
9004	FORMAT(' > ERROR < INVALID CALL IFSSCN:',3F9.4,F7.2)
	IFSTAT = -6
	KICK = -3
	CALL IFERR
	GOTO 9999
C
C   IFMOVE or IFCNT do the error handling when they fail so just return.
C   This message is for debug purposes.
9990	CONTINUE
	IF(IBUG.NE.0) WRITE(IBUG,9994)
9994	FORMAT(' > IFSSCN ABNORMAL EXIT <')
C
C======================================================================
C
C	FINAL RETURN
C
9999	RETURN
	END
