The example below is an alternative the INPUT command in the ACR controller. The routine will read one ASCII character at a time from the PC or other device. To end the transmission from the third-party controller, we look for a carriage return (ASC 13) as in IF (ASC($V0)=13) within the ReceiveData subroutine. This can then allow the programmer to continue program execution if desired as compared to the INPUT command which inhibits program execution.
Notes: The ACR9000's USB port uses Stream1. If using Ethernet, ACR-View will connect to the first available of the 4 streams (Stream2 - 5).
To see the stream number when connected, type STREAM
Below sample uses Stream#3 while leaving ACR-View with Stream#2 connected. This will not run from ACR-View's terminal emulator. Use connect via HyperTerminal or Putty (use Port 5002 which is the ASCII port)
If testing with PBOOT within the program, use ACR-View and CLOSE #3 before doing a REBOOT command to test the power-up function.
PROGRAM
DIM LV4
DIM $V(10,50)
OPEN "STREAM3:" AS #3 : REM Open communication to PC
_loop
print #3, "enter something"
$V2="" : GOSUB ReceiveData
print #3, "something is: ",$V1
goto loop
_ReceiveData
$V1=""
WHILE (3)
IF (KBHIT(3))
$V2=GETCH(3)
IF (ASC($V2)=13) : rem ASC 13 is carriage return
BREAK : REM Break out of the WHILE loop
ELSE
$V1=$V1+$V2
endif
endif
WEND
RETURN
ENDP
jw 12/2016
updated 3/7/17jh
Add Comment