
1-23
Program Example
Section 1-10
Co
m
p
o
W
a
y
/F
Co
m
m
u
n
ica
tio
n
s
1-10 Program Example
N88Basic
This program displays the response from the K3HB on the screen when com-
mand data is entered from the keyboard.
Command data from the unit number to the number of elements must be
entered.
The program was created in N88BASIC.
1000
1010
1020
1030
1040
1050
1060
1070
1080
1090
1100
1110
1120
1130
1140
1150
1160
1170
1180
1190
1200
1210
1220
1230
1240
1250
1260
1270
1280
1290
1300
1310
1320
1330
1340
1350
1360
1370
1380
1390
1400
1410
1420
1430
1440
1450
1460
1470
1480
1490
1500
1510
1520
1530
1540
1550
1560
1570
'----------------------------------------------------
'PROGRAM: E5AR/ER Communication Sample Program(CompoWay/F)
'VERSION:1.00
(c)Copyright OMRON Corporation 2003
All Rights Reserved
'----------------------------------------------------
'
'======Communication port (PARITY=EVEN, DATA=7, STOP=2) ======"
'
OPEN "COM:E73" AS
#
1
'
∗
SENDDATA
'
========= Communication routine==================
'
--------Communication data input----------
INPUT "SEND DATA:",SEND$
'
--------If no input, jump to end routine----------
IF SEND$ = " " THEN
∗
EXITSEND
'
-------BCC calculation--------
BCC = 0
SEND$ = SEND$+CHR$(3)
FOR I=1 TO LEN(SEND$)
BCC = BCC XOR ASC(MID$(SEND$, I, 1))
NEXT I
BCC$ = CHR$(BCC)
'
------Send----------
SDATA$ = CHR$(2)+SEND$+BCC$
PRINT
#
1, SDATA$;
'
========= Receive routine ===========
'
RDATA$ = " "
TIMEOUT = 0
∗
RCVLOOP
-------No response detection-------
TIMEOUT = 1
IF TIMEOUT > 2000 THEN RESP$ = "No Response":GOTO
∗
RCVEND
IF LOC(1) = 0 THEN
∗
RCVLOOP
'
-----Check for end character (if no end character, continue reading)
RDATA$ = RDATA$+INPUT$(LOC(1),
#
1)
IF LEN(RDATA$) <2 THEN
∗
RCVLOOP
IF MID$(RDATA$,LEN(RDATA$)-1,1)
<>
CHR$(3) THEN
∗
RCVLOOP
RESP$ = MID$(RDATA$,2,LEN(RDATA$)-2)
∗
RCVEND
'
-------Display received data-----------
PRINT "RESPONSE:";RESP$
GOTO
∗
SENDDATA
'
∗
EXITSEND
=========End routine==========
CLOSE
#
1
END
Содержание K3HB
Страница 2: ...K3HB Digital Indicators Communications User s Manual Revised March 2005...
Страница 3: ...iv...
Страница 15: ...xvi...
Страница 19: ...xx...
Страница 21: ...Part 1 CompoWay F...
Страница 69: ...Part 2 DeviceNet...
Страница 95: ...6 10 Ladder Programming Examples Section 4 3 Remote I O Com munications...
Страница 103: ...7 8 Explicit Messages Specific to DeviceNet compatible Digital Indicators Section 5 3 Explicit Message Communications...
Страница 111: ...8 8 Message Communications Performance Section 6 2 Communications Performance...
Страница 127: ...Part 3 BCD Output...
Страница 147: ......