1 ascii code table, 2 reserved words/language elements, Reserved word list – KEYENCE SR-700 Series User Manual
Page 18: Priority of operator, Ascii code table, Reserved words/language elements, 7 controlling output terminals, 8 others
18
E SR SCRIPT RM
7 Controlling output terminals
To use scripts to control the output terminals, you have to set "Enable scripts," and
then configure the settings as shown below.
7-1
Controlling output terminals (OK/NG/ERROR)
7-2
Preventing duplicate reading
8 Others
8-1
Appending brackets to AI of GS1-128, GS1 Databar and GS1-DataMatrix.
Brackets are appended to AI. Download this sample program from KEYENCE Web
page.
function readformatEvent()
local
r_data = result()
local
data = readResult():readData()
if
r_data == 0
then
outonEvent(1)
elseif
r_data == 2
then
outonEvent(2)
else
outonEvent(1)
outonEvent(2)
end
return
(data)
end
If the result is OK, turn on OUT1.
--If the result is ERROR, turn on
OUT2.
--In all other situations, turn on
OUT1 and OUT2.
Execution result
Read data
: keyence
Execution result
: OUT1 turns on.
local
g_latestData = ""
function readformatEvent()
local
r_data = result()
local
readData = readResult():readData()
if
r_data == 0
then
if
g_latestData == readData
then
return
""
end
g_latestData = readData
outonEvent(1)
return
readData
elseif
r_data == 2
then
outonEvent(2)
return
"ERROR"
end
end
--Branching depending on the result (OK/ERROR)
--Read data
--OK
--ERROR
Execution result
Read data
: keyence
Execution result
: keyence (The same data is not output twice.)
8-1
ASCII code table
8-2
Reserved words/Language
elements
Reserved word list
* Do not use variables/functions starting with "_" (underscore).
Priority of operator
High-order 4 bits
Hexadecimal
number
0
1
2
3
4
5
6
7
Binary
number
0000
0001
0010
0011
0100
0101
0110
0111
Low-
order 4
bits
0
0000
NUL
000
DLE
016
(SP)
032
0
048
@
064
P
080
`
096
p
112
1
0001
SOH
001
DC1
017
!
033
1
049
A
065
Q
081
a
097
q
113
2
0010
STX
002
DC2
018
"
034
2
050
B
066
R
082
b
098
r
114
3
0011
ETX
003
DC3
019
#
035
3
051
C
067
S
083
c
099
s
115
4
0100
EOT
004
DC4
020
$
036
4
052
D
068
T
084
d
100
t
116
5
0101
ENQ
005
NAK
021
%
021
5
053
E
069
U
085
e
101
u
117
6
0110
ACK
006
SYN
022
&
038
6
054
F
070
V
086
f
102
v
118
7
0111
BEL
007
ETB
023
'
039
7
055
G
071
W
087
g
103
w
119
8
1000
BS
008
CAN
024
(
040
8
056
H
072
X
088
h
104
x
120
9
1001
HT
009
EM
025
)
041
9
057
I
073
Y
089
i
105
y
121
A
1010
LF
010
SUB
026
*
042
:
058
J
074
Z
090
j
106
z
122
B
1011
VT
011
ESC
027
+
043
;
059
K
075
[
091
k
107
{
123
C
1100
CL
012
FS
028
,
044
<
060
L
076
\
092
l
108
|
124
D
1101
CR
013
GS
029
-
045
=
061
M
077
]
093
m
109
}
125
E
1110
SOH
014
RS
030
.
046
>
062
N
078
^
094
n
110
~
126
F
1111
SI
015
US
031
/
047
?
063
O
079
_
095
o
111
DEL
127
and
break
do
else
elseif
end
false
for
function
goto
if
in
local
nil
not
or
repeat
return
then
true
until
while
^
not # - (unary)
* / %
+ -
..
< > <= >= ~= ==
and
or
High
Low