Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
U
uniset2
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
UniSet project repositories
uniset2
Commits
ee470b31
Commit
ee470b31
authored
Sep 01, 2009
by
Pavel Vaynerman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed bug in MTR
parent
a1850448
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
24 additions
and
13 deletions
+24
-13
libuniset.spec
conf/libuniset.spec
+4
-1
MTR.h
extensions/include/MTR.h
+18
-10
ModbusTypes.h
include/modbus/ModbusTypes.h
+2
-0
ModbusTypes.cc
src/Communications/Modbus/ModbusTypes.cc
+0
-2
No files found.
conf/libuniset.spec
View file @
ee470b31
...
...
@@ -3,7 +3,7 @@
Name: libuniset
Version: 0.96
Release: eter5
0
Release: eter5
2
Summary: UniSet - library for building distributed industrial control systems
License: GPL
Group: Development/C++
...
...
@@ -175,6 +175,9 @@ rm -f %buildroot%_libdir/*.la
%exclude %_pkgconfigdir/libUniSet.pc
%changelog
* Fri Aug 21 2009 Pavel Vainerman <pv@etersoft.ru> 0.96-eter51
- minor fixes in RTUExchange
* Wed Aug 19 2009 Pavel Vainerman <pv@etersoft.ru> 0.96-eter50
- fixed bug in IOControl (blink mechanic)
...
...
extensions/include/MTR.h
View file @
ee470b31
...
...
@@ -36,18 +36,18 @@ namespace MTR
int
wsize
(
MTRType
t
);
/*!< */
// -------------------------------------------------------------------------
//
const
ModbusRTU
::
ModbusData
regModelNumber
=
300
01
;
const
ModbusRTU
::
ModbusData
regSerialNumber
=
300
09
;
const
ModbusRTU
::
ModbusData
regModelNumber
=
0x
01
;
const
ModbusRTU
::
ModbusData
regSerialNumber
=
0x
09
;
std
::
string
getModelNumber
(
ModbusRTUMaster
*
mb
,
ModbusRTU
::
ModbusAddr
addr
);
std
::
string
getSerialNumber
(
ModbusRTUMaster
*
mb
,
ModbusRTU
::
ModbusAddr
addr
);
// -------------------------------------------------------------------------
//
const
ModbusRTU
::
ModbusData
regAddress
=
400
55
;
const
ModbusRTU
::
ModbusData
regBaudRate
=
400
56
;
const
ModbusRTU
::
ModbusData
regStopBit
=
400
57
;
/* 0 - Stop bit, 1 - Stop bits */
const
ModbusRTU
::
ModbusData
regParity
=
400
58
;
const
ModbusRTU
::
ModbusData
regDataBits
=
400
59
;
//
( - read03, - write06)
const
ModbusRTU
::
ModbusData
regAddress
=
55
;
const
ModbusRTU
::
ModbusData
regBaudRate
=
56
;
const
ModbusRTU
::
ModbusData
regStopBit
=
57
;
/* 0 - Stop bit, 1 - Stop bits */
const
ModbusRTU
::
ModbusData
regParity
=
58
;
const
ModbusRTU
::
ModbusData
regDataBits
=
59
;
enum
mtrBaudRate
{
...
...
@@ -497,7 +497,11 @@ namespace MTR
T_Str16
(
const
ModbusRTU
::
ReadInputRetMessage
&
ret
)
{
char
c
[
16
];
memcpy
(
c
,
&
ret
.
data
,
sizeof
(
c
));
ModbusRTU
::
ModbusData
data
[
8
];
for
(
int
i
=
0
;
i
<
8
;
i
++
)
data
[
i
]
=
ModbusRTU
::
SWAPSHORT
(
ret
.
data
[
i
]);
memcpy
(
c
,
&
data
,
sizeof
(
c
));
sval
=
std
::
string
(
c
);
}
...
...
@@ -511,6 +515,7 @@ namespace MTR
std
::
string
sval
;
};
// --------------------------------------------------------------------------
class
T_Str8
{
public
:
...
...
@@ -520,7 +525,10 @@ namespace MTR
T_Str8
(
const
ModbusRTU
::
ReadInputRetMessage
&
ret
)
{
char
c
[
8
];
memcpy
(
c
,
&
ret
.
data
,
sizeof
(
c
));
ModbusRTU
::
ModbusData
data
[
4
];
for
(
int
i
=
0
;
i
<
4
;
i
++
)
data
[
i
]
=
ModbusRTU
::
SWAPSHORT
(
ret
.
data
[
i
]);
memcpy
(
c
,
&
data
,
sizeof
(
c
));
sval
=
std
::
string
(
c
);
}
...
...
include/modbus/ModbusTypes.h
View file @
ee470b31
...
...
@@ -59,6 +59,8 @@ namespace ModbusRTU
const
unsigned
char
MBErrMask
=
0x80
;
// ---------------------------------------------------------------------
static
unsigned
short
SWAPSHORT
(
unsigned
short
x
)
{
return
((((
x
)
>>
8
)
&
0xff
)
|
(((
x
)
<<
8
)
&
0xff00
));
}
// ---------------------------------------------------------------------
/*! ޣ */
ModbusCRC
checkCRC
(
ModbusByte
*
start
,
int
len
);
const
int
szCRC
=
sizeof
(
ModbusCRC
);
/*!< */
...
...
src/Communications/Modbus/ModbusTypes.cc
View file @
ee470b31
...
...
@@ -11,8 +11,6 @@
using
namespace
ModbusRTU
;
using
namespace
std
;
// -------------------------------------------------------------------------
#define SWAPSHORT(x) ((((x)>>8)&0xff)|(((x)<<8)&0xff00))
// -------------------------------------------------------------------------
#define USE_CRC_TAB 1 // ޣ
// -------------------------------------------------------------------------
// Lav: , .
...
...
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