KEYENCE LS-3100/3100W Series User Manual
Page 67

61
CHAPTER 4 Functions and Controls
Program 3
The following settings are specified through the computer: simultaneous
measurement of DIA and EDGE1, 100 samplings for each of DIA and EDG1,
and display of maximum, minimum and average values of these measure-
ments.
Performs arithmetic
operation to obtain
maximum, minimum, and
average values
Processors or discards
data received after
continuous output has
been stopped
100
DIM D$ (100), E$ (100)
110
OPEN "COM1:4800,N,8,1,RS,CS,DS,CD" FOR RANDOM AS #1
120
PRINT #1, "X1D"
Sets segment selector X, measurement part 1, and DIA
130
PRINT #1, "Y1E"
Sets segment selector Y, measurement part 1, and EDGE1
140
PRINT #1, "VC0"
Sets output channel CH1 and arithmetic operation "X"
150
PRINT #1, "VMN"
Sets output channel CH1 and NORMAL mode
160
PRINT #1, "WC1"
Sets output channel CH2 and arithmetic operation "Y"
170
PRINT #1, "WMN"
Sets output channel CH2 and NORMAL mode
180
PRINT "START or END ? (Press [S] or [E] key)"
190
200
A$=INPUT$ (1)
210
IF A$="E" OR A$="e" THEN END
220
IF A$<> "S" AND A$<> "S" THEN 200
230
PRINT #1, "X5"
Sets continuous output of CH1 and then CH2 data
240
FOR I=1 TO 100
250
INPUT #1, D$ (I)
Inputs data
260
INPUT #1, E$ (I)
270
NEXT I
280
PRINT #1, "X6"
Stops continuous output
290
FOR I=1 TO 500 :NEXT I
300
IF EOF (1) = 0 THEN INPUT #1, DAMMY$ : GOTO 300
310
DMAX=-10000 :DMIN=10000 :DSUM=0
320
EMAX=-10000 "EMIN=10000 :ESUM=0
330
FOR I=1 TO 100
340
D=VAL (D$ (I))
350
IF D>DMAX THEN DAMX=D
360
IF D 370 DSUM=DSUM+D 380 E=VAL (E$ (I)) 390 IF E>EMAX THEN EMAX=E 400 IF E 410 ESUM=ESUM+E 420 NEXT I 430 DAVE=DUSM/100 440 EAVE=ESUM/100 450 PRINT "[DIA] [EDGE]" 460 PRINT USING "MAX = ####,#### mm ####, #### mm" ; DMAX, EMAX 470 PRINT USING "MIN = ####, #### mm ####, #### mm" ; DMIN, EMIN 480 PRINT USING "AVE = ####, #### mm ####, #### mm" ;DAVE, EAVE 490 PRINT 500 GOTO 180 Note: The baud rate is set to 4800 bps in these 3 examples. Set the baud rate according to your requirements. Displays Displays prompt for 08.10.1, 10:56 AM 61
maximum,
minimum and
average
values
starting or ending
measurement