Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions otherio/lib/rt/src/os_linux/rt_io_m_mb_tcp_server.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* ProviewR Open Source Process Control.
* Copyright (C) 2005-2018 SSAB EMEA AB.
* Copyright (C) 2005-2019 SSAB EMEA AB.
*
* This file is part of ProviewR.
*
Expand Down Expand Up @@ -182,7 +182,7 @@ static void* mb_receive(void* data)
break;
}

addr -= mp->ReadAddress;
addr -= mp->ReadRegAddress;

if (addr < 0 || addr + quant * 2 > local_card->output_size) {
exception_code = 2;
Expand Down Expand Up @@ -252,6 +252,8 @@ static void* mb_receive(void* data)
break;
}

addr -= mp->ReadDigAddress;

offs = addr / 8;
bytes = (addr + quant) / 8 + (((addr + quant) % 8 == 0) ? 0 : 1) - offs;

Expand Down Expand Up @@ -332,7 +334,7 @@ static void* mb_receive(void* data)
break;
}

addr -= mp->WriteAddress;
addr -= mp->WriteRegAddress;

if (addr < 0 || addr + 2 > local_card->input_size) {
exception_code = 2;
Expand Down Expand Up @@ -397,7 +399,7 @@ static void* mb_receive(void* data)
break;
}

addr -= mp->WriteAddress;
addr -= mp->WriteRegAddress;

if (addr < 0 || addr + quant * 2 > local_card->input_size) {
exception_code = 2;
Expand Down Expand Up @@ -459,6 +461,8 @@ static void* mb_receive(void* data)
break;
}

addr -= mp->WriteDigAddress;

offs = addr / 8;

if (addr < 0 || offs + local_card->di_offset >= local_card->input_size
Expand Down Expand Up @@ -535,6 +539,7 @@ static void* mb_receive(void* data)
exception_code = 2;
break;
}
addr -= mp->WriteDigAddress;

offs = addr / 8;
bytes = (addr + quant) / 8 + (((addr + quant) % 8 == 0) ? 0 : 1) - offs;
Expand Down
64 changes: 50 additions & 14 deletions otherio/wbl/mcomp/src/otherio.wb_load
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
! Generated by wb_print_wbl 02-MAR-2020 23:49:56.61
! Volume OtherIO
! Version V5.7.0
Volume OtherIO $ClassVolume 0.0.250.10
Body SysBody 01-JAN-1970 01:00:00.00
Attr NextOix = "_X668"
Expand Down Expand Up @@ -2217,7 +2220,7 @@ Volume OtherIO $ClassVolume 0.0.250.10
Object RtBody $ObjBodyDef 1 08-FEB-2008 10:26:36.84
Body SysBody 08-FEB-2008 10:26:36.85
Attr StructName = "Modbus_TCP_Slave"
Attr NextAix = "_X21"
Attr NextAix = "_X23"
EndBody
!/**
! Description of slave
Expand Down Expand Up @@ -2331,6 +2334,19 @@ Volume OtherIO $ClassVolume 0.0.250.10
EndBody
EndObject
!/**
! Network format is set to little endian.
! The standard network format for Modbus TCP is big endian. Despite
! this, slaves despite this uses little endian. Setting byte
! ordering to little endian makes it possible to connect to such slaves.
!*/
Object ByteOrderingLE $Attribute 22 29-MAR-2019 11:26:24.84
Body SysBody 29-MAR-2019 11:26:54.23
Attr PgmName = "ByteOrderingLE"
Attr Size = 4
Attr TypeRef = "pwrs:Type-$Boolean"
EndBody
EndObject
!/**
! @Summary Error count of the slave.
! ErrorCount will increase every cycle if status is not MB__NORMAL.
! When ErrorCount reaches the ErrorLimit all inputs are reset to zero.
Expand Down Expand Up @@ -3355,7 +3371,7 @@ Volume OtherIO $ClassVolume 0.0.250.10
Object RtBody $ObjBodyDef 1 25-NOV-2009 11:05:23.49
Body SysBody 25-NOV-2009 11:06:00.66
Attr StructName = "Modbus_TCP_ServerModule"
Attr NextAix = "_X21"
Attr NextAix = "_X23"
EndBody
!/**
! Description of the object.
Expand All @@ -3373,12 +3389,10 @@ Volume OtherIO $ClassVolume 0.0.250.10
! The value defines the starting address for the input channels
! of class ChanIi and ChanAi.
!
! Note that the address for ReadDiscreteInputs and ReadCoils are
! not affected by the ReadAddress.
!*/
Object ReadAddress $Attribute 12 04-DEC-2009 16:53:13.17
Body SysBody 04-DEC-2009 16:53:32.47
Attr PgmName = "ReadAddress"
Object ReadRegAddress $Attribute 12 02-MAR-2020 17:48:30.72
Body SysBody 02-MAR-2020 17:48:52.08
Attr PgmName = "ReadRegAddress"
Attr Size = 4
Attr TypeRef = "pwrs:Type-$UInt32"
EndBody
Expand All @@ -3390,12 +3404,34 @@ Volume OtherIO $ClassVolume 0.0.250.10
! The value defines the starting address for the output channels
! of class ChanIo and ChanAo.
!
! Note that the address for WriteSingleCoil and WriteMultipleCoils
! are not affected by the WriteAddress.
!*/
Object WriteAddress $Attribute 13 04-DEC-2009 16:53:43.87
Body SysBody 04-DEC-2009 16:53:45.81
Attr PgmName = "WriteAddress"
Object WriteRegAddress $Attribute 13 02-MAR-2020 17:50:49.91
Body SysBody 02-MAR-2020 17:49:25.67
Attr PgmName = "WriteRegAddress"
Attr Size = 4
Attr TypeRef = "pwrs:Type-$UInt32"
EndBody
EndObject
!/**
! @Summary Address for reading digital inputs.
! Address for reading with function code ReadInputs.
! The value defines the starting address for the input channels of class ChanDi
!*/
Object ReadDigAddress $Attribute 21 02-MAR-2020 17:42:32.87
Body SysBody 02-MAR-2020 17:41:32.19
Attr PgmName = "ReadDigAddress"
Attr Size = 4
Attr TypeRef = "pwrs:Type-$UInt32"
EndBody
EndObject
!/**
! @Summary Address for writing digital outputs.
! Address for reading with function code WriteCoils.
! The value defines the starting address for the input channels of class ChanDo
!*/
Object WriteDigAddress $Attribute 22 02-MAR-2020 17:50:02.32
Body SysBody 02-MAR-2020 17:50:14.30
Attr PgmName = "WriteDigAddress"
Attr Size = 4
Attr TypeRef = "pwrs:Type-$UInt32"
EndBody
Expand Down Expand Up @@ -5947,9 +5983,9 @@ Volume OtherIO $ClassVolume 0.0.250.10
Object FirmwareVersion $Attribute 27 05-FEB-2012 16:33:33.69
Body SysBody 05-FEB-2012 16:33:52.27
Attr PgmName = "FirmwareVersion"
Attr Size = 40
Attr Size = 132
Attr Flags = 1024
Attr TypeRef = "pwrs:Type-$String40"
Attr TypeRef = "pwrs:Type-$String132"
EndBody
EndObject
EndObject
Expand Down