6100 MPS-B Programming Manual
6100 MPS-B PROGRAMMING EXAMPLE
?PAGE "PROCEDURE: REPLY^LINE"
PROC reply^line;
BEGIN
INT retry^count := 0;
slinebuff ’:=’ [ STX ] & ["YOUR MESSAGE HAS BEEN RECEIVED"]
& [ ETX ] -> @sp;
start^of^msg ’:=’ slinebuff FOR
(buff^len := @sp ’-’ @slinebuff);
DO
BEGIN
! Call "request" to assemble, and issue, the appropriate
! WRITEREAD request to send the message back to the terminal.
! Text Out includes the message length plus mcw (2), STX (1) and
! ETX (1).
CALL request (write^line,select^enable,(buff^len + 4));
IF status <> 0 THEN
BEGIN
IF retry^count = max^retries THEN CALL error^exit;
retry^count := retry^count + 1;
END;
END
UNTIL status = 0;
END; ! of reply^line.
B-14