Omron E5AK PROGRAMMABLE TYPE User Manual page 160

Digital controller (programmable type)
Hide thumbs Also See for E5AK PROGRAMMABLE TYPE:
Table of Contents

Advertisement

CHAPTER 6 USING THE COMMUNICATIONS FUNCTION
J Program list (language: IBM PC Compatible Machine)
1000 '
1010 ' PROGRAM : E5AK-T COMMUNICATION PROGRAM
1020 '
1050 '
1060 '
Default RS-232C SPEED: 9600BPS, PARITY: EVEN, DATA: 7, STOP: 2
1070 OPEN "COM: E73" AS #1
1080 *REPEAT
1090 '
Enter send data
1100 INPUT "send data : " , SEND$
1110'
FCS calculation
1120 FCS=0
1130 FOR IFCS=1 TO LEN (SEND$)
1140 FCS=FCS XOR ASC (MID$ (SEND$, IFCS, 1))
1150 NEXT
1160 FCS$=RIGHT$ ("0"+HEX$ (FCS), 2)
1170 '
Execute communications
1180 ZZZ$=SEND$+FCS$+"*"+CHR$ (13)
1190 PRINT #1, ZZZ$;
1120'
Check response
1210 RECCNT=0: TMP$=""
1220 *DRECLOOP:
1230 IF LOC (1) < > 0 THEN DREC1
1240 RECCNT=RECCNT+1
1250 IF RECCNT=5000 THEN *DRECERR ELSE DRECLOOP
1260 *DREC1
1270 TMP$=TMP$+INPUT$ (LOC (1), #1)
1280 IF RIGHT$ (TMP$, 1)=CHR$ (13) THEN *DRECEND
ELSE RECCNT=0: GOTO *DRECLOOP
1290 *DRECERR
1300 TMP$="No response !!" +CHR$ (13)
1310 *DRECEND
1320 RECV$=TMP$
1330 PRINT "receive data : " ; RECV$
1340 '
Repeat to make Command
1350' GOTO *REPEAT
1360 '
END
1370 CLOSE #1
1380 END
6--18
FOR IBM PC COMPATBLE MACHINE

Advertisement

Table of Contents
loading

This manual is also suitable for:

E5ak-t

Table of Contents