I am having the worst time trying to fix someone else's program. This program takes temperatures. If a temperature is greater than or equal to .2 of a target temperature then a new setpoint is to be calculated. Everytime the program takes the 6 readings I get an out of subscript range on the DEV(K) = Abs(TP(K, XX) - Target(K)). Any help with this will be greatly appreciated thank you
CLS: Screen 12: SFLAG = 0
Dim T(100), TP(6, 25), SPP(6, 25)
LOCATE 1, 1: INPUT "PROFILE FURNACE (1)-REVIEW PROFILE (2)-FULL PROFILE (3)", X
If X = 2 Then GoTo REVIEW
If X = 3 Then GoSub CPROFILE
If X = 4 Then GoSub HOLD
CLS
LOCATE 1, 1: INPUT "PLEASE ENTER YOUR INITIALS ", NAME$
CLS
If Name$ = "SUPR" Then GoSub ENTRY
10 LOCATE 1, 1: Print " FURNACE PROFILING ROUTINE"
LOCATE 2, 1: INPUT "PLEASE ENTER FURNACE #", F$
If Len(F$) = 1 Then F$ = "0" + F$
F$ = Right$(F$, 2)
Open "c:\data\" + F$ For Input As #1
Input #1, Target(1), SPP(1, 1), Target(2), SPP(2, 1), Target(3), SPP(3, 1), Target(4), SPP(4, 1), Target(5), SPP(5, 1), Target(6), SPP(6, 1)
Close #1
LOCATE 4, 1: Print "RESETTING DRIVE"
Open "COM2:9600,N,8,1,RS,CS,DS" For Random As #1
A$ = "1K"
Print #1, A$
SLEEP 1
A$ = "VE2.5 DI100 GO"
Print #1, A$
SLEEP 1
GoSub RHOME
A$ = "1K"
Print #1, A$
SLEEP 2
A$ = "SP0 VE0.25"
Print #1, A$
LOCATE 4, 1: Print " "
499 A$ = "DA-48.00 GO": Print #1, A$
LOCATE 4, 2: INPUT "CONNECT T/C TO DRIVE & PRESS ENTER WHEN DONE", Z$
A$ = "VE2.5": Print #1, A$
LOCATE 5, 2: Print "REACHING 0 POSITION"
LOCATE 6, 2: INPUT "CHECK POSITION OF T/C & PRESS ENTER WHEN READY", Z$
GoSub COMPUTE
501 If SFLAG = 1 Then
CLS
For K = 1 To 6
LOCATE 5 + K, 5: Print "FINAL SETPOINT"; K; " "; SPP(K, XX)
Next K
GoSub CPROF
End If
If SFLAG = -1 Then End
End
ENTRY: CLS
Print "ENTER PROFILE VALUE, SETPOINT FOR EACH ZONE"
INPUT "FURNACE #"; F$
If Len(F$) = 1 Then F$ = "0" + F$
F$ = Right$(F$, 2)
For I = 1 To 6
PRINT I; : INPUT TARGET(I), SPP(I, 1)
Next I
Open "c:\data\" + F$ For Output As #1
Write #1, Target(1), SPP(1, 1), Target(2), SPP(2, 1), Target(3), SPP(3, 1), Target(4), SPP(4, 1), Target(5), SPP(5, 1), Target(6), SPP(6, 1)
Close #1
CLS
Return
RHOME: I = 1: R1$ = "XX"
2000 A$ = "PA1": Print #1, A$
R$ = ""
For tt = 1 To 100
Next tt
If Loc(1) > 0 Then
Do
R$ = R$ + Input$(1, 1)
For T = 1 To 200
Next T
Loop While Not EOF(1)
If I > 1 Then
If R1$ = R$ Then Return
End If
End If
I = I + 1: R1$ = R$
GoTo 2000
Return
COMPUTE:
On Key(9) GoSub COMPLETE
KEY(9) ON
CLS
XX = 1: Rem XX is the counter for pulls
Rem SPP are setpoints to the controllers
Rem TARGET are the target profile temps
1010 If XX = 1 Then
LOCATE 1, 5: Print "PLEASE ADJUST T/C POSITION"
Else
LOCATE 1, 5: Print " "
End If
LOCATE 3, 5: Print "PLEASE ENTER THE FOLLOWING SETPOINTS INTO THE CONTROLLERS"
LOCATE 6, 35: Print "setpoint 1:"; SPP(1, XX)
LOCATE 7, 35: Print "setpoint 2:"; SPP(2, XX)
LOCATE 8, 35: Print "setpoint 3:"; SPP(3, XX)
LOCATE 9, 35: Print "setpoint 4:"; SPP(4, XX)
LOCATE 10, 35: Print "setpoint 5:"; SPP(5, XX)
LOCATE 11, 35: Print "setpoint 6:"; SPP(6, XX)
Print "PRESS SPACEBAR WHEN READY TO TAKE PULL #"; XX
Do
Loop While INKEY$ <> Chr$(32)
Rem INPUT PULL READINGS
CLS
GoSub PULL
FILE$ = "c:\data\" + F$ + Left$(Date$, 2) + Mid$(Date$, 4, 2) + Right$(Date$, 2) + ".LOG"
Open FILE$ For Append As #5
Write #5, AVET(1), AVET(2), AVET(3), AVET(4), AVET(5), AVET(6)
Close #5
Rem DIM DEV(K) AS DOUBLE
DEV = 0: Max = 0
For K = 1 To 6
TP(K, XX) = AVET(K): Rem TP is the result of the pull
DEV(K) = Abs(TP(K, XX) - Target(K))
Open "C:\DEV.TXT" For Output As #8
Write #8, DEV(K)
Close #8
Next K
If DEV > Max Then Max = DEV
Rem ALL 6 DEVIATIONS HAVE TO BE LESS THAN .2 TO ACQUIRE PROFILE
If DEV(1) < 0.2 And DEV(2) < 0.2 And DEV(3) < 0.2 And DEV(4) < 0.2 And DEV(5) < 0.2 And DEV(6) < 0.2 Then SFLAG = 1: Return: Rem SEQUENCE SUCCESFUL
Rem IF 25 PULLS HAVE BEEN TAKEN AND ANY OF THE 6 DEVIATIONS
Rem ARE GREATER THAN OR EQUAL TO .2 THEN END THE PROGRAM
Rem JUST POSES THE QUESTION OF A POSSIBLE HARDWARE FAILURE
Rem SETPOINT SHOULD BE SET WITHIN 25 PULLS
If XX = 25 And DEV(1) >= 0.2 Then SFLAG = -1: Return:
If XX = 25 And DEV(2) >= 0.2 Then SFLAG = -1: Return:
If XX = 25 And DEV(3) >= 0.2 Then SFLAG = -1: Return:
If XX = 25 And DEV(4) >= 0.2 Then SFLAG = -1: Return:
If XX = 25 And DEV(5) >= 0.2 Then SFLAG = -1: Return:
If XX = 25 And DEV(6) >= 0.2 Then SFLAG = -1: Return:
Rem INSTANCE OF MORE THAN ONE PULL
If XX > 1 Then
SFLAG = 1
For Z = 1 To 6
Rem CHECK THE PREVIOUS SETPOINT AGAINST THE NEW POINT
Rem TO FIND NEW DEVIATION
Rem IF DEVIATION IS OK THEN RETURN TO ACQUIRE FINAL PROFILE
If Abs(SPP(Z, XX - 1) - SPP(Z, XX)) >= 0.2 Then SFLAG = -1
Next Z
If SFLAG = 1 Then Return
End If
For Z = 1 To 6
A(Z) = Target(Z) - TP(Z, XX)
X(Z) = Target(Z) / SPP(Z, XX)
SPP(Z, XX + 1) = Int(10 * (SPP(Z, XX) + A(Z) / X(Z))) / 10
Next Z
XX = XX + 1
GoTo 1010
Rem DON'T THINK IS RETURN IS EVER EXECUTED RETURN
COMPLETE:
SFLAG = 1
RETURN 501
PULL:
CLS
I = 1: GoSub READT: Rem position 0
LOCATE 5 + I, 5: Print "POS. 0 T="; Int(10 * AVET(I)) / 10; " ("; Target(1); ""
A$ = "VE1 DI5 GO": Print #1, A$: SLEEP 180
I = 2: GoSub READT: Rem position 5
LOCATE 5 + I, 5: Print "POS. 5 T="; Int(10 * AVET(I)) / 10; " ("; Target(2); ""
A$ = "DI10 GO": Print #1, A$: SLEEP 180
I = 3: GoSub READT: Rem position 15
LOCATE 5 + I, 5: Print "POS.15 T="; Int(10 * AVET(I)) / 10; " ("; Target(3); ""
A$ = "DI10 GO": Print #1, A$: SLEEP 180
I = 4: GoSub READT: Rem position 25
LOCATE 5 + I, 5: Print "POS.25 T="; Int(10 * AVET(I)) / 10; " ("; Target(4); ""
A$ = "DI10 GO": Print #1, A$: SLEEP 180
I = 5: GoSub READT: Rem position 35
LOCATE 5 + I, 5: Print "POS.35 T="; Int(10 * AVET(I)) / 10; " ("; Target(5); ""
A$ = "DI9 GO": Print #1, A$: SLEEP 180
I = 6: GoSub READT: Rem position 44
LOCATE 5 + I, 5: Print "POS.44 T="; Int(10 * AVET(I)) / 10; " ("; Target(6); ""
A$ = "DA-48.00 GO": Print #1, A$
Return
READT:
Open "COM1:9600,O,7,1,RS,CS,DS" For Random As #2
AVET(I) = 0: Q = 0
For K = 1 To 100
AGAIN: R$ = ""
Print #2, "*X04"
For tt = 1 To 200
Next tt
If Loc(2) > 0 Then
Do
R$ = R$ + Input$(1, 2)
For tt = 1 To 150
Next tt
Loop While Not EOF(2)
LOCATE 20, 1: Print R$
If Left$(R$, 1) <> "X" Then GoTo AGAIN
If Val(Mid$(R$, 4, 7)) > 0 Then Q = Q + 1
AVET(I) = AVET(I) + Val(Mid$(R$, 4, 7))
End If
Next K
Close #2
AVET(I) = AVET(I) / Q
Return
CPROFILE:
INPUT "PLEASE ENTER FURNACE #", F$
If Len(F$) = 1 Then F$ = "0" + F$
F$ = Right$(F$, 2)
CLS: GoTo X
CPROF: Close
Open "c:\data\" + F$ For Output As #1
Write #1, Target(1), SPP(1, XX), Target(2), SPP(2, XX), Target(3), SPP(3, XX), Target(4), SPP(4, XX), Target(5), SPP(5, XX), Target(6), SPP(6, XX)
Close #1
X: Print " ACQUIRING COMPLETE PROFILE"
Close
Open "COM2:9600,N,8,1,RS,CS,DS" For Random As #1
Open "COM1:9600,O,7,1,RS,CS,DS" For Random As #2
A$ = "1K VE.15 DA-48.00 GO": Print #1, A$
GoSub RHOME
SLEEP 60
For I = 0 To 44
T(I) = 0: N = 0
For K = 1 To 100
AG2: R$ = ""
Print #2, "*X04"
For tt = 1 To 200
Next tt
If Loc(2) > 0 Then
Do
R$ = R$ + Input$(1, 2)
For tt = 1 To 150
Next tt
Loop While Not EOF(2)
LOCATE 20, 1: Print R$
If Left$(R$, 1) <> "X" Then GoTo AG2
If Val(Mid$(R$, 4, 7)) > 0 Then N = N + 1
T(I) = T(I) + Val(Mid$(R$, 4, 7))
End If
Next K
T(I) = T(I) / N
A$ = "VE1 DI1 GO": Print #1, A$
LOCATE 2, 2: Print "Position: "; I, "T: "; T(I)
SLEEP 80
Next I
A$ = "VE0.1 DA0 GO": Print #1, A$
Close
FILE$ = "c:\data\" + F$ + Left$(Date$, 2) + Mid$(Date$, 4, 2) + Right$(Date$, 2) + ".PRF"
Open FILE$ For Output As #3
For I = 0 To 44
Write #3, I, T(I)
Next I
Close #3
Max = 0: Min = 5000
For I = 0 To 44
If T(I) > Max Then Max = T(I)
If T(I) < Min Then Min = T(I)
Next I
AY = 300 / (Min - Max)
By = 25 - Max * 300 / (Min - Max)
AX = -540 / 44
BX = 590
For I = 0 To 44
X = AX * I + BX
Y = AY * T(I) + By
If T(I) < 1238 Then C% = 11 Else C% = 14
For K = 1 To 3
Circle (X, Y), K, C%
Next K
Next I
Do
Loop While INKEY$ <> Chr$(32)
Return
REVIEW:
AGAN: LOCATE 2, 1: INPUT "PLEASE ENTER FURNACE #", F$
If Len(F$) = 1 Then F$ = "0" + F$
F$ = Right$(F$, 2)
Shell "DIR c:\data\" + F$ + "*.PRF"
INPUT "CHOOSE THE FILE YOU NEED", FILE$
Rem CLS
FILE$ = "c:\data\" + FILE$ + ".PRF"
Open FILE$ For Input As #3
For I = 0 To 44
Input #3, I, T(I)
Next I
Close #3
Max = 0: Min = 5000
For I = 0 To 44
If T(I) > Max Then Max = T(I)
If T(I) < Min Then Min = T(I)
Next I
AY = 300 / (Min - Max)
By = 25 - Max * 300 / (Min - Max)
AX = -540 / 44
BX = 590
For I = 0 To 44
X = AX * I + BX
Y = AY * T(I) + By
If T(I) < 1238 Then C% = 11 Else C% = 15
For K = 1 To 3
Circle (X, Y), K, C%
Next K
Next I
Do
Loop While INKEY$ <> Chr$(32)
GoTo AGAN
End
HOLD:
Open "COM2:9600,N,8,1,RS,CS,DS" For Random As #1
Open "COM1:9600,O,7,1,RS,CS,DS" For Random As #2
A$ = "1K VE.25 DA-24.00 GO": Print #1, A$
GoSub RHOME: CLS
RST: SLEEP 120
T = 0: N = 0
For K = 1 To 100
AG3: R$ = ""
Print #2, "*X04"
For tt = 1 To 200
Next tt
If Loc(2) > 0 Then
Do
R$ = R$ + Input$(1, 2)
For tt = 1 To 150
Next tt
Loop While Not EOF(2)
Rem LOCATE 20, 1: PRINT R$
If Left$(R$, 1) <> "X" Then GoTo AG3
If Val(Mid$(R$, 4, 7)) > 0 Then N = N + 1
T = T + Val(Mid$(R$, 4, 7))
End If
Next K
T = T / N
Open "C:\DATA\TEMPW.TXT" For Append As #4
Write #4, Date$, Time$, T
Close #4
Print Date$, Time$, T
GoTo RST
Return
CLS: Screen 12: SFLAG = 0
Dim T(100), TP(6, 25), SPP(6, 25)
LOCATE 1, 1: INPUT "PROFILE FURNACE (1)-REVIEW PROFILE (2)-FULL PROFILE (3)", X
If X = 2 Then GoTo REVIEW
If X = 3 Then GoSub CPROFILE
If X = 4 Then GoSub HOLD
CLS
LOCATE 1, 1: INPUT "PLEASE ENTER YOUR INITIALS ", NAME$
CLS
If Name$ = "SUPR" Then GoSub ENTRY
10 LOCATE 1, 1: Print " FURNACE PROFILING ROUTINE"
LOCATE 2, 1: INPUT "PLEASE ENTER FURNACE #", F$
If Len(F$) = 1 Then F$ = "0" + F$
F$ = Right$(F$, 2)
Open "c:\data\" + F$ For Input As #1
Input #1, Target(1), SPP(1, 1), Target(2), SPP(2, 1), Target(3), SPP(3, 1), Target(4), SPP(4, 1), Target(5), SPP(5, 1), Target(6), SPP(6, 1)
Close #1
LOCATE 4, 1: Print "RESETTING DRIVE"
Open "COM2:9600,N,8,1,RS,CS,DS" For Random As #1
A$ = "1K"
Print #1, A$
SLEEP 1
A$ = "VE2.5 DI100 GO"
Print #1, A$
SLEEP 1
GoSub RHOME
A$ = "1K"
Print #1, A$
SLEEP 2
A$ = "SP0 VE0.25"
Print #1, A$
LOCATE 4, 1: Print " "
499 A$ = "DA-48.00 GO": Print #1, A$
LOCATE 4, 2: INPUT "CONNECT T/C TO DRIVE & PRESS ENTER WHEN DONE", Z$
A$ = "VE2.5": Print #1, A$
LOCATE 5, 2: Print "REACHING 0 POSITION"
LOCATE 6, 2: INPUT "CHECK POSITION OF T/C & PRESS ENTER WHEN READY", Z$
GoSub COMPUTE
501 If SFLAG = 1 Then
CLS
For K = 1 To 6
LOCATE 5 + K, 5: Print "FINAL SETPOINT"; K; " "; SPP(K, XX)
Next K
GoSub CPROF
End If
If SFLAG = -1 Then End
End
ENTRY: CLS
Print "ENTER PROFILE VALUE, SETPOINT FOR EACH ZONE"
INPUT "FURNACE #"; F$
If Len(F$) = 1 Then F$ = "0" + F$
F$ = Right$(F$, 2)
For I = 1 To 6
PRINT I; : INPUT TARGET(I), SPP(I, 1)
Next I
Open "c:\data\" + F$ For Output As #1
Write #1, Target(1), SPP(1, 1), Target(2), SPP(2, 1), Target(3), SPP(3, 1), Target(4), SPP(4, 1), Target(5), SPP(5, 1), Target(6), SPP(6, 1)
Close #1
CLS
Return
RHOME: I = 1: R1$ = "XX"
2000 A$ = "PA1": Print #1, A$
R$ = ""
For tt = 1 To 100
Next tt
If Loc(1) > 0 Then
Do
R$ = R$ + Input$(1, 1)
For T = 1 To 200
Next T
Loop While Not EOF(1)
If I > 1 Then
If R1$ = R$ Then Return
End If
End If
I = I + 1: R1$ = R$
GoTo 2000
Return
COMPUTE:
On Key(9) GoSub COMPLETE
KEY(9) ON
CLS
XX = 1: Rem XX is the counter for pulls
Rem SPP are setpoints to the controllers
Rem TARGET are the target profile temps
1010 If XX = 1 Then
LOCATE 1, 5: Print "PLEASE ADJUST T/C POSITION"
Else
LOCATE 1, 5: Print " "
End If
LOCATE 3, 5: Print "PLEASE ENTER THE FOLLOWING SETPOINTS INTO THE CONTROLLERS"
LOCATE 6, 35: Print "setpoint 1:"; SPP(1, XX)
LOCATE 7, 35: Print "setpoint 2:"; SPP(2, XX)
LOCATE 8, 35: Print "setpoint 3:"; SPP(3, XX)
LOCATE 9, 35: Print "setpoint 4:"; SPP(4, XX)
LOCATE 10, 35: Print "setpoint 5:"; SPP(5, XX)
LOCATE 11, 35: Print "setpoint 6:"; SPP(6, XX)
Print "PRESS SPACEBAR WHEN READY TO TAKE PULL #"; XX
Do
Loop While INKEY$ <> Chr$(32)
Rem INPUT PULL READINGS
CLS
GoSub PULL
FILE$ = "c:\data\" + F$ + Left$(Date$, 2) + Mid$(Date$, 4, 2) + Right$(Date$, 2) + ".LOG"
Open FILE$ For Append As #5
Write #5, AVET(1), AVET(2), AVET(3), AVET(4), AVET(5), AVET(6)
Close #5
Rem DIM DEV(K) AS DOUBLE
DEV = 0: Max = 0
For K = 1 To 6
TP(K, XX) = AVET(K): Rem TP is the result of the pull
DEV(K) = Abs(TP(K, XX) - Target(K))
Open "C:\DEV.TXT" For Output As #8
Write #8, DEV(K)
Close #8
Next K
If DEV > Max Then Max = DEV
Rem ALL 6 DEVIATIONS HAVE TO BE LESS THAN .2 TO ACQUIRE PROFILE
If DEV(1) < 0.2 And DEV(2) < 0.2 And DEV(3) < 0.2 And DEV(4) < 0.2 And DEV(5) < 0.2 And DEV(6) < 0.2 Then SFLAG = 1: Return: Rem SEQUENCE SUCCESFUL
Rem IF 25 PULLS HAVE BEEN TAKEN AND ANY OF THE 6 DEVIATIONS
Rem ARE GREATER THAN OR EQUAL TO .2 THEN END THE PROGRAM
Rem JUST POSES THE QUESTION OF A POSSIBLE HARDWARE FAILURE
Rem SETPOINT SHOULD BE SET WITHIN 25 PULLS
If XX = 25 And DEV(1) >= 0.2 Then SFLAG = -1: Return:
If XX = 25 And DEV(2) >= 0.2 Then SFLAG = -1: Return:
If XX = 25 And DEV(3) >= 0.2 Then SFLAG = -1: Return:
If XX = 25 And DEV(4) >= 0.2 Then SFLAG = -1: Return:
If XX = 25 And DEV(5) >= 0.2 Then SFLAG = -1: Return:
If XX = 25 And DEV(6) >= 0.2 Then SFLAG = -1: Return:
Rem INSTANCE OF MORE THAN ONE PULL
If XX > 1 Then
SFLAG = 1
For Z = 1 To 6
Rem CHECK THE PREVIOUS SETPOINT AGAINST THE NEW POINT
Rem TO FIND NEW DEVIATION
Rem IF DEVIATION IS OK THEN RETURN TO ACQUIRE FINAL PROFILE
If Abs(SPP(Z, XX - 1) - SPP(Z, XX)) >= 0.2 Then SFLAG = -1
Next Z
If SFLAG = 1 Then Return
End If
For Z = 1 To 6
A(Z) = Target(Z) - TP(Z, XX)
X(Z) = Target(Z) / SPP(Z, XX)
SPP(Z, XX + 1) = Int(10 * (SPP(Z, XX) + A(Z) / X(Z))) / 10
Next Z
XX = XX + 1
GoTo 1010
Rem DON'T THINK IS RETURN IS EVER EXECUTED RETURN
COMPLETE:
SFLAG = 1
RETURN 501
PULL:
CLS
I = 1: GoSub READT: Rem position 0
LOCATE 5 + I, 5: Print "POS. 0 T="; Int(10 * AVET(I)) / 10; " ("; Target(1); ""
A$ = "VE1 DI5 GO": Print #1, A$: SLEEP 180
I = 2: GoSub READT: Rem position 5
LOCATE 5 + I, 5: Print "POS. 5 T="; Int(10 * AVET(I)) / 10; " ("; Target(2); ""
A$ = "DI10 GO": Print #1, A$: SLEEP 180
I = 3: GoSub READT: Rem position 15
LOCATE 5 + I, 5: Print "POS.15 T="; Int(10 * AVET(I)) / 10; " ("; Target(3); ""
A$ = "DI10 GO": Print #1, A$: SLEEP 180
I = 4: GoSub READT: Rem position 25
LOCATE 5 + I, 5: Print "POS.25 T="; Int(10 * AVET(I)) / 10; " ("; Target(4); ""
A$ = "DI10 GO": Print #1, A$: SLEEP 180
I = 5: GoSub READT: Rem position 35
LOCATE 5 + I, 5: Print "POS.35 T="; Int(10 * AVET(I)) / 10; " ("; Target(5); ""
A$ = "DI9 GO": Print #1, A$: SLEEP 180
I = 6: GoSub READT: Rem position 44
LOCATE 5 + I, 5: Print "POS.44 T="; Int(10 * AVET(I)) / 10; " ("; Target(6); ""
A$ = "DA-48.00 GO": Print #1, A$
Return
READT:
Open "COM1:9600,O,7,1,RS,CS,DS" For Random As #2
AVET(I) = 0: Q = 0
For K = 1 To 100
AGAIN: R$ = ""
Print #2, "*X04"
For tt = 1 To 200
Next tt
If Loc(2) > 0 Then
Do
R$ = R$ + Input$(1, 2)
For tt = 1 To 150
Next tt
Loop While Not EOF(2)
LOCATE 20, 1: Print R$
If Left$(R$, 1) <> "X" Then GoTo AGAIN
If Val(Mid$(R$, 4, 7)) > 0 Then Q = Q + 1
AVET(I) = AVET(I) + Val(Mid$(R$, 4, 7))
End If
Next K
Close #2
AVET(I) = AVET(I) / Q
Return
CPROFILE:
INPUT "PLEASE ENTER FURNACE #", F$
If Len(F$) = 1 Then F$ = "0" + F$
F$ = Right$(F$, 2)
CLS: GoTo X
CPROF: Close
Open "c:\data\" + F$ For Output As #1
Write #1, Target(1), SPP(1, XX), Target(2), SPP(2, XX), Target(3), SPP(3, XX), Target(4), SPP(4, XX), Target(5), SPP(5, XX), Target(6), SPP(6, XX)
Close #1
X: Print " ACQUIRING COMPLETE PROFILE"
Close
Open "COM2:9600,N,8,1,RS,CS,DS" For Random As #1
Open "COM1:9600,O,7,1,RS,CS,DS" For Random As #2
A$ = "1K VE.15 DA-48.00 GO": Print #1, A$
GoSub RHOME
SLEEP 60
For I = 0 To 44
T(I) = 0: N = 0
For K = 1 To 100
AG2: R$ = ""
Print #2, "*X04"
For tt = 1 To 200
Next tt
If Loc(2) > 0 Then
Do
R$ = R$ + Input$(1, 2)
For tt = 1 To 150
Next tt
Loop While Not EOF(2)
LOCATE 20, 1: Print R$
If Left$(R$, 1) <> "X" Then GoTo AG2
If Val(Mid$(R$, 4, 7)) > 0 Then N = N + 1
T(I) = T(I) + Val(Mid$(R$, 4, 7))
End If
Next K
T(I) = T(I) / N
A$ = "VE1 DI1 GO": Print #1, A$
LOCATE 2, 2: Print "Position: "; I, "T: "; T(I)
SLEEP 80
Next I
A$ = "VE0.1 DA0 GO": Print #1, A$
Close
FILE$ = "c:\data\" + F$ + Left$(Date$, 2) + Mid$(Date$, 4, 2) + Right$(Date$, 2) + ".PRF"
Open FILE$ For Output As #3
For I = 0 To 44
Write #3, I, T(I)
Next I
Close #3
Max = 0: Min = 5000
For I = 0 To 44
If T(I) > Max Then Max = T(I)
If T(I) < Min Then Min = T(I)
Next I
AY = 300 / (Min - Max)
By = 25 - Max * 300 / (Min - Max)
AX = -540 / 44
BX = 590
For I = 0 To 44
X = AX * I + BX
Y = AY * T(I) + By
If T(I) < 1238 Then C% = 11 Else C% = 14
For K = 1 To 3
Circle (X, Y), K, C%
Next K
Next I
Do
Loop While INKEY$ <> Chr$(32)
Return
REVIEW:
AGAN: LOCATE 2, 1: INPUT "PLEASE ENTER FURNACE #", F$
If Len(F$) = 1 Then F$ = "0" + F$
F$ = Right$(F$, 2)
Shell "DIR c:\data\" + F$ + "*.PRF"
INPUT "CHOOSE THE FILE YOU NEED", FILE$
Rem CLS
FILE$ = "c:\data\" + FILE$ + ".PRF"
Open FILE$ For Input As #3
For I = 0 To 44
Input #3, I, T(I)
Next I
Close #3
Max = 0: Min = 5000
For I = 0 To 44
If T(I) > Max Then Max = T(I)
If T(I) < Min Then Min = T(I)
Next I
AY = 300 / (Min - Max)
By = 25 - Max * 300 / (Min - Max)
AX = -540 / 44
BX = 590
For I = 0 To 44
X = AX * I + BX
Y = AY * T(I) + By
If T(I) < 1238 Then C% = 11 Else C% = 15
For K = 1 To 3
Circle (X, Y), K, C%
Next K
Next I
Do
Loop While INKEY$ <> Chr$(32)
GoTo AGAN
End
HOLD:
Open "COM2:9600,N,8,1,RS,CS,DS" For Random As #1
Open "COM1:9600,O,7,1,RS,CS,DS" For Random As #2
A$ = "1K VE.25 DA-24.00 GO": Print #1, A$
GoSub RHOME: CLS
RST: SLEEP 120
T = 0: N = 0
For K = 1 To 100
AG3: R$ = ""
Print #2, "*X04"
For tt = 1 To 200
Next tt
If Loc(2) > 0 Then
Do
R$ = R$ + Input$(1, 2)
For tt = 1 To 150
Next tt
Loop While Not EOF(2)
Rem LOCATE 20, 1: PRINT R$
If Left$(R$, 1) <> "X" Then GoTo AG3
If Val(Mid$(R$, 4, 7)) > 0 Then N = N + 1
T = T + Val(Mid$(R$, 4, 7))
End If
Next K
T = T / N
Open "C:\DATA\TEMPW.TXT" For Append As #4
Write #4, Date$, Time$, T
Close #4
Print Date$, Time$, T
GoTo RST
Return