Why is Controller Reporting Program Stuck?

PROGRAM

'THIS PROGRAM IS INTENDED TO BE RUN FROM AN EXTERNAL TERMINAL
'SUCH AS HYPERTERMINAL
'FOR HYPERTERMINAL, USE PORT 5002 TO CONNECT WINSOCK TO ACR9000 ETHERNET

CLEAR : REM Clear any variables dimension in program
DIM $V(1,10) : REM Dimensions one string variable of length 10
GOSUB OPENPORT : REM Go to SUBROUTINE OPENPORT
END
'SUBROUTINE OPENPORT
_OPENPORT
'Opens Ethernet Stream3 (ACR-View uses Stream2)
OPEN "STREAM3:" AS #1
'Continuous loop as long as "X" is not entered
_LOOP1
'Set String Variable 0 to nothing
$V0 = ""
PRINT #1, ""
PRINT #1, "What kind of fruit do you want?"
PRINT #1, "(A)pple, (B)anana, (C)oconut"
PRINT #1, "I would like to have a";
'Infinite WHILE loop if they do not enter anything
WHILE ($V0 = "")
$V0 = UCASE$(INKEY$(1))
REM Stores Keyboard entry into String Variable 0
WEND
IF ($V0 = "A") THEN PRINT #1, "n Apple"
REM If "A" was entered, then print n Apple
IF ($V0 = "B") THEN PRINT #1, " Banana"
REM If "B" was entered, then print Banana
IF ($V0 = "C") THEN PRINT #1, " Coconut"
REM If "C" was entered, then print Coconut
IF ($V0 = "X") THEN GOTO LOOP2
REM If "X" was entered, then goto LOOP2 to terminate program
IF ($V0 = CHR$(27)) THEN GOTO LOOP2
REM If "ESC key" was entered, then goto LOOP2 to terminate program
'Goes back to LOOP1
GOTO LOOP1
_LOOP2
PRINT #1, "Program terminated"
CLOSE #1
RETURN
ENDP

Products: ACR9000, 9030,9040,9600,9630,9640, Aries Controller (AR-xxCE)

When using INPUT commands in AcroBasic programs, it is possible for the program to get STUCK. If the program is running and waiting on INPUT and then halted, subsequent calls to run will get an error.

P00>run
Program Stuck

To recover from this condition clear the reserved program flag shown in this list for the program in question.

PROGRAM

Bit #

0

1035

1

1067

2

1099

3

1131

4

1163

5

1195

6

1227

7

1259

8

1291

9

1323

10

1355

11

1387

12

1419

13

1451

14

1483

15

1515

 

 

To prevent, consider using an Escape key as an option to exit (see INKEY_update.txt above) and/or a timeout if a character isn't sent within some period of time.

 

 

JW 16-May-2012