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
8419bfc7
Commit
8419bfc7
authored
Apr 04, 2014
by
Claes Sjofors
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Modbus TCP, disable slave with disconnect added
parent
60a9150a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
54 additions
and
16 deletions
+54
-16
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
+13
-3
otherio/wbl/mcomp/src/otherio.wb_load
otherio/wbl/mcomp/src/otherio.wb_load
+41
-13
No files found.
otherio/lib/rt/src/os_linux/rt_io_m_mb_tcp_slave.c
View file @
8419bfc7
...
...
@@ -868,12 +868,20 @@ static pwr_tStatus IoRackRead (
sp
=
(
pwr_sClass_Modbus_TCP_Slave
*
)
rp
->
op
;
if
(
sp
->
DisableSlave
==
2
)
{
sp
->
Status
=
MB__CONNDOWN
;
close
(
local
->
s
);
sp
->
DisableSlave
=
1
;
}
if
(
sp
->
Status
==
MB__DISABLED
&&
sp
->
DisableSlave
==
0
)
sp
->
Status
=
MB__NORMAL
;
if
(((
sp
->
Status
==
MB__CONNDOWN
)
||
(
sp
->
Status
==
MB__CONNLOST
))
&&
sp
->
DisableSlave
!=
1
)
{
/* Reconnect */
time_GetTimeMonotonic
(
&
now
);
time_Adiff
(
&
dt
,
&
now
,
&
local
->
last_try_connect_time
);
if
(
dt
.
tv_sec
>=
(
1
<<
MIN
(
sp
->
ReconnectCount
,
6
)))
{
if
(
dt
.
tv_sec
>=
(
1
<<
MIN
(
sp
->
ReconnectCount
,
6
)))
{
sts
=
connect_slave
(
local
,
rp
);
if
(
sts
>=
0
)
{
sp
->
ReconnectCount
=
0
;
...
...
@@ -905,7 +913,8 @@ static pwr_tStatus IoRackRead (
}
else
{
sp
->
ErrorCount
=
0
;
sp
->
Status
=
MB__DISABLED
;
if
(
sp
->
Status
!=
MB__CONNDOWN
)
sp
->
Status
=
MB__DISABLED
;
}
return
IO__SUCCESS
;
...
...
@@ -935,7 +944,8 @@ static pwr_tStatus IoRackWrite (
sts
=
mb_send_data
(
local
,
rp
,
sp
,
mb_mSendMask_WriteReq
);
}
if
(
sp
->
DisableSlave
==
1
)
sp
->
Status
=
MB__DISABLED
;
if
(
sp
->
DisableSlave
==
1
&&
sp
->
Status
!=
MB__CONNDOWN
)
sp
->
Status
=
MB__DISABLED
;
return
IO__SUCCESS
;
}
...
...
otherio/wbl/mcomp/src/otherio.wb_load
View file @
8419bfc7
Volume OtherIO $ClassVolume 0.0.250.10
Body SysBody 01-JAN-1970 01:00:00.00
Attr NextOix = "_X6
29
"
Attr NextOix = "_X6
32
"
Attr NextCix = "_X47"
Attr NextTix[0] = "_X1
7
"
Attr NextTix[0] = "_X1
8
"
EndBody
Object Type $TypeHier 1 15-NOV-2007 14:35:37.90
Object MotionControl_StatusEnum $TypeDef 1 15-NOV-2007 14:36:24.17
...
...
@@ -246,7 +246,7 @@ Volume OtherIO $ClassVolume 0.0.250.10
EndObject
EndObject
Object ModbusSever_StatusEnum $TypeDef 4 25-NOV-2009 11:10:38.85
Body SysBody
13-DEC-2010 21:41:14.95
Body SysBody
03-APR-2014 13:45:03.70
Attr TypeRef = "pwrs:Type-$Enum"
Attr Elements = 1
EndBody
...
...
@@ -299,6 +299,32 @@ Volume OtherIO $ClassVolume 0.0.250.10
EndBody
EndObject
EndObject
Object Modbus_DisableEnum $TypeDef 0 03-APR-2014 13:43:57.18
Body SysBody 03-APR-2014 13:45:08.43
Attr TypeRef = "pwrs:Type-$Enum"
Attr Elements = 1
EndBody
Object No $Value 630 03-APR-2014 13:44:16.86
Body SysBody 03-APR-2014 13:44:20.30
Attr Text = "No"
Attr PgmName = "No"
EndBody
EndObject
Object Disable $Value 631 03-APR-2014 13:44:25.15
Body SysBody 03-APR-2014 13:44:28.45
Attr Text = "Disable"
Attr PgmName = "Disable"
Attr Value = 1
EndBody
EndObject
Object Close $Value 632 03-APR-2014 13:44:33.37
Body SysBody 03-APR-2014 13:44:37.18
Attr Text = "Close"
Attr PgmName = "Close"
Attr Value = 2
EndBody
EndObject
EndObject
Object Arduino_StatusEnum $TypeDef 5 13-DEC-2010 21:41:03.92
Body SysBody 03-JAN-2011 21:07:03.74
Attr TypeRef = "pwrs:Type-$Enum"
...
...
@@ -2266,14 +2292,16 @@ Volume OtherIO $ClassVolume 0.0.250.10
EndBody
EndObject
!/**
! @Summary Flag that disables the slave.
! Flag that disables the initialization of the slave, if initialized turns off i/o-handling.
! Disables the slave.
! When set to Disable no messages are sent. When Close is activated the
! connection is also closed. Note that the value is set to Disable
! after a Close is performed.
!*/
Object DisableSlave $Attribute 16 20-FEB-2008 15:38:59.22
Body SysBody 0
8-SEP-2008 14:45:03.01
Body SysBody 0
3-APR-2014 13:45:59.34
Attr PgmName = "DisableSlave"
Attr Size = 4
Attr TypeRef = "
pwrb:Type-YesNo
Enum"
Attr TypeRef = "
OtherIO:Type-Modbus_Disable
Enum"
EndBody
EndObject
!/**
...
...
@@ -9883,17 +9911,17 @@ Volume OtherIO $ClassVolume 0.0.250.10
! PiFace Digital is an IO interface card to Raspberry Pi.
! The card contains 8 digital inputs and 8 digital outputs.
! The inputs and outputs are configured with internal channel arrays, ChDi and ChDo.
!
!
! The board uses the SPI bus which has to be enabled on the Raspberry Pi. See
! the PiFace manual for more information.
!
!
! The PiFace_Digital object is configured as a child to a generic Rack object of class
! BaseIORack.
!
! The PiFace Digital interface uses the libpiface-V1.0 archive. If Process is set to Plc
! this archive has to be present in the development enviroment, and specified in a
! BuildOptions object. If this is not the case, use the default IoComm process.
!
!
! @b See also
! @classlink BaseIORack basecomponent_baseiorack.html
! @link Datasheet ../dsh/piface_digital.pdf
...
...
@@ -9961,7 +9989,7 @@ Volume OtherIO $ClassVolume 0.0.250.10
Attr Size = 4
Attr TypeRef = "pwrs:Type-$UInt32"
EndBody
EndObject
EndObject
!/**
! Digital input channel array.
!*/
...
...
@@ -10052,7 +10080,7 @@ Volume OtherIO $ClassVolume 0.0.250.10
! Gertboard is an IO interface card to Raspberry Pi.
! This object handles 12 buffered IO that can be configured as digital inputs or outputs,
! two analog inputs and two analog outputs.
!
!
! @h2 Digital channels
! The buffered IO is configured with internal channel objects Buf1 - Buf12 of type ChanD.
! Each buffered IO is connected to a gpio on the Raspberry Pi and the gpio number should be
...
...
@@ -10063,7 +10091,7 @@ Volume OtherIO $ClassVolume 0.0.250.10
! revision.
! Note also that if the analog input or output is used, five of the gpio are reserved for
! the SPI bus and these should not be configured for buffered IO.
!
!
! @h2 Analog channels
! The analog channels uses the SPI bus and thus five of the gpio are used for the bus
! communication. These have to be configured on the board. See the Gertboard manual for more
...
...
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