Programming Examples 47
SR620 Universal Time Interval Counter
490 CALL ENTER (ANS$,LENGTH%,SR620%,STATUS%): GOSUB 890 'get answer
500 TMODE% = VAL (ANS$) ' TIC mode
510 CALL SEND (SR620%,EXPD$,STATUS%): GOSUB 890
520 ANS$ = SPACE$(50)
530 CALL ENTER (ANS$,LENGTH%,SR620%,STATUS%): GOSUB 890
540 TEXPD% = VAL(ANS$)
550 '
560 '
570 ' convert data to correct format
580 '
590 ' get 8 bytes (4 * 2bytes) corresponding to one sample
600 FOR I = 1 TO SAMPLES%
610 SIGN = 0
620 FDATA#(I) = 0#
630 FOR J = 1 TO 4
640 TEMP#(J) = DAT%(4*(I-1)+J)
650 IF TEMP#(J) < 0# THEN TEMP#(J) = 65536#+TEMP#(J)
660 NEXT J
670 ' if answer < 0 change sign and get magnitude
680 IF (DAT%(4*(I-1)+4) >= 0) GOTO 740
690 SIGN =1
700 FOR J = 1 TO 4
710 TEMP#(J) = 65535#-TEMP#(J)
720 NEXT J
730 ' convert to floating point
740 FOR J = 1 TO 4
750 FDATA#(I) = FDATA#(I)*65536# + TEMP#(5-J)
760 NEXT J
770 ' if negative increment ( to get 2's complement) and change sign
780 IF SIGN <> 0 THEN FDATA#(I) = -1#*(FDATA#(I)+1#)
790 ' multiply by conversion factor
800 FDATA#(I) = FACTORS#(TMODE%+1)*FDATA#(I)
810 ' change scale if expand is on
820 IF TEXPD% <> 0 THEN FDATA#(I) = FDATA#(I)*.001#
830 NEXT I
840 PRINT "data"
850 FOR I = 1 TO SAMPLES%
860 PRINT FDATA#(I)
870 NEXT I
880 GOTO 280
890 ' check for status error of last GPIB interraction
900 IF STATUS% = 0 THEN RETURN
910 PRINT "gpib error. status = ";STATUS%
920 STOP
Summary of Contents for SR620
Page 2: ...SR620 Universal Time Interval Counter...
Page 6: ...iv Table of Contents SR620 Universal Time Interval Counter...
Page 8: ...vi Safety and Preparation for Use SR620 Universal Time Interval Counter...
Page 12: ...x Specifications SR620 Universal Time Interval Counter...
Page 58: ...42 Programming Commands SR620 Universal Time Interval Counter...
Page 72: ...56 Programming Examples SR620 Universal Time Interval Counter...
Page 76: ...60 Troubleshooting Tips SR620 Universal Time Interval Counter...
Page 82: ...66 Performance Test SR620 Universal Time Interval Counter...
Page 90: ...74 Calibration Procedure SR620 Universal Time Interval Counter...
Page 102: ...86 Circuit Description SR620 Universal Time Interval Counter...
Page 124: ...108 Parts List SR620 Universal Time Interval Counter...