8 Examples
To send and receive data via a web browser, you can use the included ajax.js library or
any other supporting AJAX technology (eg Jquery).
8.1
Connection of 1 device
The following example shows one device assigned to Modbus RTU with physical address 1
and register addresses 4000 and 4001.
Modification of the POINTS.xml file:
<
group
>
<
id
>
Temperatura_
<
/id
>
//variable name
<
id_start
>
5
</
id_start
>
//starting number
<
len
>
2
</
len
>
//number of points in the group
<
protocol
>
RTU
</
protocol
>
<
dev_addr
>
1
</
dev_addr
>
//physical address
<
cmd
>
MB_MULTIHOLD
</
cmd
>
<
address
>
4000
</
address
>
//the initial address of registers
<
access
>
rw
</
access
>
<
pool
>
50
</
pool
>
</
group
>
//end of the group
Take a look.
Only one group
BUT
with two points has been defined in the POINTS.xml file.
Then modify the file in a web directory with the name eg index.htm
<
html
>
<
head
>
<
meta
http
-
equiv
=
"content-type"
content
=
"text/html; charset=ISO-8859-2"
>
<
title
>
Przykladowa
strona
</
title
>
<
script
src
=
"/ajax.js"
type
=
"text/javascript"
></
script
>
</
head
>
<
body
>
<
p
>
Parametr
1
:
<
span
id
=
"data1"
>
?
</
span
>
<
button
id
=
"btn1"
onclick
=
"setData('Temperatura_5',16,32)"
>
Ustaw
</
button
>
</
p
>
<
p
>
Parametr
2
:
<
span
id
=
"data2"
>
?
</
span
>
<
button id
=
"btn2"
onclick
=
"setData('Temperatura_6',16,32)"
>
Ustaw
</
button
>
</
p
>
<
script
type
=
"text/javascript"
><!--
function
updateStatus
(
xmlData
)
{
setTimeout
(
"newAJAXCommand('comm.xml', updateStatus, false)"
,
500
);
if
(!
xmlData
)
return
;
document.getElementById
(
'data1'
).
innerHTML
=
getXMLValue
(
xmlData
,
'Temperatura_5'
);
User manual
μSCADA
Page
14
of
15
[B03]