Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
proview
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Esteban Blanc
proview
Commits
d6855af6
Commit
d6855af6
authored
Mar 04, 2010
by
Claes Sjofors
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Modbus TCP, function code WriteSingleRegister added
parent
a7b09b7c
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
66 additions
and
40 deletions
+66
-40
otherio/lib/rt/src/os_linux/rt_io_m_mb_tcp_servermodule.c
otherio/lib/rt/src/os_linux/rt_io_m_mb_tcp_servermodule.c
+0
-4
otherio/lib/rt/src/os_linux/rt_io_m_mb_tcp_slave.c
otherio/lib/rt/src/os_linux/rt_io_m_mb_tcp_slave.c
+28
-0
otherio/wbl/mcomp/src/otherio.wb_load
otherio/wbl/mcomp/src/otherio.wb_load
+38
-36
No files found.
otherio/lib/rt/src/os_linux/rt_io_m_mb_tcp_servermodule.c
View file @
d6855af6
...
...
@@ -87,8 +87,6 @@ static pwr_tStatus IoCardRead (
pwr_sClass_Modbus_TCP_ServerModule
*
op
;
pwr_sClass_Modbus_TCP_Server
*
server
;
printf
(
"Module: Read method
\n
"
);
op
=
(
pwr_sClass_Modbus_TCP_ServerModule
*
)
cp
->
op
;
local
=
(
io_sServerModuleLocal
*
)
cp
->
Local
;
server
=
(
pwr_sClass_Modbus_TCP_Server
*
)
rp
->
op
;
...
...
@@ -124,8 +122,6 @@ static pwr_tStatus IoCardWrite (
pwr_sClass_Modbus_TCP_ServerModule
*
op
;
pwr_sClass_Modbus_TCP_Server
*
server
;
printf
(
"Module: Write method
\n
"
);
op
=
(
pwr_sClass_Modbus_TCP_ServerModule
*
)
cp
->
op
;
local
=
(
io_sServerModuleLocal
*
)
cp
->
Local
;
server
=
(
pwr_sClass_Modbus_TCP_Server
*
)
rp
->
op
;
...
...
otherio/lib/rt/src/os_linux/rt_io_m_mb_tcp_slave.c
View file @
d6855af6
...
...
@@ -303,6 +303,7 @@ pwr_tStatus mb_recv_data(io_sRackLocal *local,
case
pwr_eModbus_FCEnum_WriteMultipleCoils
:
case
pwr_eModbus_FCEnum_WriteMultipleRegisters
:
case
pwr_eModbus_FCEnum_WriteSingleRegister
:
// Nothing good to do here
break
;
}
...
...
@@ -513,6 +514,33 @@ pwr_tStatus mb_send_data(io_sRackLocal *local,
wrr
.
bc
=
local_card
->
output_size
;
memcpy
(
wrr
.
reg
,
local_card
->
output_area
,
local_card
->
output_size
);
sts
=
send
(
local
->
s
,
&
wrr
,
ntohs
(
wrr
.
head
.
length
)
+
6
,
MSG_DONTWAIT
);
if
(
sts
<
0
)
{
sp
->
Status
=
MB__CONNDOWN
;
close
(
local
->
s
);
errh_Error
(
"Connection down to modbus slave, %s"
,
rp
->
Name
);
return
IO__SUCCESS
;
}
sp
->
TX_packets
++
;
local
->
expected_msgs
++
;
break
;
}
case
pwr_eModbus_FCEnum_WriteSingleRegister
:
{
write_single_req
wrr
;
mp
->
SendOp
=
FALSE
;
local
->
trans_id
++
;
local_card
->
trans_id
=
local
->
trans_id
;
wrr
.
head
.
trans_id
=
htons
(
local
->
trans_id
);
wrr
.
head
.
proto_id
=
0
;
wrr
.
head
.
length
=
htons
(
sizeof
(
wrr
)
-
6
);
wrr
.
head
.
unit_id
=
mp
->
UnitId
;
wrr
.
fc
=
mp
->
FunctionCode
;
wrr
.
addr
=
htons
(
mp
->
Address
);
memcpy
(
&
wrr
.
value
,
local_card
->
output_area
,
sizeof
(
wrr
.
value
));
sts
=
send
(
local
->
s
,
&
wrr
,
ntohs
(
wrr
.
head
.
length
)
+
6
,
MSG_DONTWAIT
);
if
(
sts
<
0
)
{
sp
->
Status
=
MB__CONNDOWN
;
...
...
otherio/wbl/mcomp/src/otherio.wb_load
View file @
d6855af6
...
...
@@ -637,7 +637,6 @@ Volume OtherIO $ClassVolume 0.0.250.10
Object Port $Attribute 19 04-DEC-2009 17:22:45.73
Body SysBody 04-DEC-2009 17:23:01.72
Attr PgmName = "Port"
Attr Flags = 16777216
Attr TypeRef = "pwrs:Type-$UInt32"
EndBody
EndObject
...
...
@@ -1297,7 +1296,9 @@ Volume OtherIO $ClassVolume 0.0.250.10
EndObject
EndObject
Object Template Modbus_TCP_Server 2149285888 01-JAN-1970 01:00:00.00
Body RtBody 01-JAN-1970 01:00:00.00
Body RtBody 03-MAR-2010 16:51:13.57
Attr Process = 1
Attr ErrorLimit = 50
EndBody
EndObject
EndObject
...
...
@@ -1432,7 +1433,8 @@ Volume OtherIO $ClassVolume 0.0.250.10
EndObject
EndObject
Object Template Modbus_TCP_ServerModule 2149548032 01-JAN-1970 01:00:00.00
Body RtBody 01-JAN-1970 01:00:00.00
Body RtBody 03-MAR-2010 16:49:58.18
Attr Process = 1
EndBody
EndObject
EndObject
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment