![LiCONiC StoreX Series Скачать руководство пользователя страница 71](http://html1.mh-extra.com/html/liconic/storex-series/storex-series_operating-manual_1907204071.webp)
StoreX
Series
STX_V078.doc
70
CMa,
23.11.2009
FUNCTION STX_ReadBackStr(pN:INTEGER; s:STRING):STRING;
CONST tries=2;
VAR i,n,m,err:INTEGER; w:WORD; s0,s1:STRING; c,kp:CHAR;
BEGIN
IF NOT(kbdEsc) THEN
BEGIN
EmptyAux(pN);
i:=-1;
s0:=s;
m:=Pos('-',s0);
IF m>0 THEN
BEGIN
Delete(s0,m,1);
s1:=Copy(s0,m,Length(s0));
Val(s1,n,err);
Delete(s0,m,Length(s0));
w:=-n; Str(w,s1); s0:=s0+s1
END;
REPEAT
Inc(i);
EmptyAux(pN); auxStrOut(pN,s0+cr);
IF i>3 THEN DelayMs(100);
auxStrIn(pN,s1,5,lf);
Delete(s1,PRED(Length(s1)),2)
UNTIL (s1[1]<>'E') OR (i>tries) OR KbdEsc;
STX_ReadBackStr:=s1;
END
ELSE
STX_ReadBackStr:=''
END;
8.2.3
Open / Close Communication
Prior to communication with the controller, the communication has to be opened.
Before communication is opened, the controller only accepts the Open
Communication Command (CR). For improved safety, it is recommended that
communication is closed (CQ) when no communication is required for a long
period of time.
Command
Response
Open Communication
CR
cr
CC
cr lf
Send Commands (see below)
Close Communication
CQ
cr
CF
cr lf
The two example programs show how to open and close communication to the
StoreX.
FUNCTION STX_OpenCom(pN:INTEGER):STRING;
BEGIN
STX_OpenCom:=STX_ReadBackStr(pN,'CR')
END;
Time out functions and communication error can be trapped at this
level.
FUNCTION STX_CloseCom(pN:INTEGER):STRING;
BEGIN
STX_CloseCom:=STX_ReadBackStr(pN,'CQ')
END;
Artisan Technology Group - Quality Instrumentation ... Guaranteed | (888) 88-SOURCE | www.artisantg.com