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
d27a9114
Commit
d27a9114
authored
Nov 27, 2011
by
Pavel Vainerman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(mtr-read): Добавил утилиту чтения регистров с устройств MTR (DEIF)
parent
9e1146c5
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
36 additions
and
147 deletions
+36
-147
libuniset.spec
conf/libuniset.spec
+4
-1
mtr-conv.cc
extensions/ModbusMaster/mtr-conv.cc
+32
-18
mtrconv.cc
extensions/ModbusMaster/mtrconv.cc
+0
-128
No files found.
conf/libuniset.spec
View file @
d27a9114
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
Name: libuniset
Name: libuniset
Version: 1.0
Version: 1.0
Release: alt5
6
Release: alt5
7
Summary: UniSet - library for building distributed industrial control systems
Summary: UniSet - library for building distributed industrial control systems
License: GPL
License: GPL
Group: Development/C++
Group: Development/C++
...
@@ -212,6 +212,9 @@ rm -f %buildroot%_libdir/*.la
...
@@ -212,6 +212,9 @@ rm -f %buildroot%_libdir/*.la
%changelog
%changelog
* Sun Nov 27 2011 Pavel Vainerman <pv@altlinux.ru> 1.0-alt57
- add uniset-mtr-read utility
* Sat Nov 26 2011 Pavel Vainerman <pv@altlinux.ru> 1.0-alt56
* Sat Nov 26 2011 Pavel Vainerman <pv@altlinux.ru> 1.0-alt56
- (modbus): fixed bug (again) in ModbusSlave::readInputStatus(0x02)
- (modbus): fixed bug (again) in ModbusSlave::readInputStatus(0x02)
...
...
extensions/ModbusMaster/mtr-conv.cc
View file @
d27a9114
...
@@ -13,7 +13,7 @@ static void print_help()
...
@@ -13,7 +13,7 @@ static void print_help()
}
}
// --------------------------------------------------------------------------
// --------------------------------------------------------------------------
int
main
(
int
argc
,
const
char
**
argv
)
int
main
(
int
argc
,
const
char
**
argv
)
{
{
unsigned
short
v1
=
0
;
unsigned
short
v1
=
0
;
unsigned
short
v2
=
0
;
unsigned
short
v2
=
0
;
const
char
*
type
=
""
;
const
char
*
type
=
""
;
...
@@ -22,11 +22,11 @@ int main( int argc, const char **argv )
...
@@ -22,11 +22,11 @@ int main( int argc, const char **argv )
{
{
print_help
();
print_help
();
return
1
;
return
1
;
}
}
type
=
argv
[
1
];
type
=
argv
[
1
];
v1
=
UniSetTypes
::
uni_atoi
(
argv
[
2
]);
v1
=
UniSetTypes
::
uni_atoi
(
argv
[
2
]);
if
(
argc
>=
4
)
if
(
argc
>=
4
)
{
{
v1
=
UniSetTypes
::
uni_atoi
(
argv
[
3
]);
v1
=
UniSetTypes
::
uni_atoi
(
argv
[
3
]);
...
@@ -52,50 +52,64 @@ int main( int argc, const char **argv )
...
@@ -52,50 +52,64 @@ int main( int argc, const char **argv )
{
{
T3
t
(
v1
,
v2
);
T3
t
(
v1
,
v2
);
cout
<<
"(T3): v1="
<<
t
.
raw
.
v
[
0
]
<<
" v2="
<<
t
.
raw
.
v
[
1
]
cout
<<
"(T3): v1="
<<
t
.
raw
.
v
[
0
]
<<
" v2="
<<
t
.
raw
.
v
[
1
]
<<
" --> "
<<
t
<<
endl
;
<<
" --> "
<<
(
long
)
t
<<
endl
;
}
}
else
if
(
!
strcmp
(
type
,
"T4"
)
)
else
if
(
!
strcmp
(
type
,
"T4"
)
)
{
{
T4
t
(
v1
);
T4
t
(
v1
);
cout
<<
"(T4): v1="
<<
t
.
raw
cout
<<
"(T4): v1="
<<
t
.
raw
<<
" --> "
<<
t
<<
endl
;
<<
" --> "
<<
t
.
sval
<<
endl
;
}
}
else
if
(
!
strcmp
(
type
,
"T5"
)
)
else
if
(
!
strcmp
(
type
,
"T5"
)
)
{
{
T5
t
(
v1
,
v2
);
T5
t
(
v1
,
v2
);
cout
<<
"(T5): v1="
<<
t
.
raw
.
v
[
0
]
<<
" v2="
<<
t
.
raw
.
v
[
1
]
cout
<<
"(T5): v1="
<<
t
.
raw
.
v
[
0
]
<<
" v2="
<<
t
.
raw
.
v
[
1
]
<<
" --> "
<<
t
<<
endl
;
<<
" --> "
<<
t
.
raw
.
u2
.
val
<<
" * 10^"
<<
(
int
)
t
.
raw
.
u2
.
exp
<<
" ===> "
<<
t
.
val
<<
endl
;
}
}
else
if
(
!
strcmp
(
type
,
"T6"
)
)
else
if
(
!
strcmp
(
type
,
"T6"
)
)
{
{
T6
t
(
v1
,
v2
);
T6
t
(
v1
,
v2
);
cout
<<
"(T6): v1="
<<
t
.
raw
.
v
[
0
]
<<
" v2="
<<
t
.
raw
.
v
[
1
]
cout
<<
"(T6): v1="
<<
t
.
raw
.
v
[
0
]
<<
" v2="
<<
t
.
raw
.
v
[
1
]
<<
" --> "
<<
t
<<
endl
;
<<
" --> "
<<
t
.
raw
.
u2
.
val
<<
" * 10^"
<<
(
int
)
t
.
raw
.
u2
.
exp
<<
" ===> "
<<
t
.
val
<<
endl
;
}
}
else
if
(
!
strcmp
(
type
,
"T7"
)
)
else
if
(
!
strcmp
(
type
,
"T7"
)
)
{
{
T7
t
(
v1
,
v2
);
T7
t
(
v1
,
v2
);
cout
<<
"(T7): v1="
<<
t
.
raw
.
v
[
0
]
<<
" v2="
<<
t
.
raw
.
v
[
1
]
cout
<<
"(T7): v1="
<<
t
.
raw
.
v
[
0
]
<<
" v2="
<<
t
.
raw
.
v
[
1
]
// << " --> " << T7.val << " * 10^-4"
// << " --> " << T7.val << " * 10^-4"
<<
" ===> "
<<
t
<<
endl
;
<<
" ===> "
<<
t
.
val
<<
" ["
<<
(
t
.
raw
.
u2
.
ic
==
0xFF
?
"CAP"
:
"IND"
)
<<
"|"
<<
(
t
.
raw
.
u2
.
ie
==
0xFF
?
"EXP"
:
"IMP"
)
<<
"]"
<<
endl
;
}
}
else
if
(
!
strcmp
(
type
,
"T8"
)
)
else
if
(
!
strcmp
(
type
,
"T8"
)
)
{
{
T8
t
(
v1
,
v2
);
T8
t
(
v1
,
v2
);
cout
<<
"(T8): v1="
<<
t
.
raw
.
v
[
0
]
<<
" v2="
<<
t
.
raw
.
v
[
1
]
cout
<<
"(T8): v1="
<<
t
.
raw
.
v
[
0
]
<<
" v2="
<<
t
.
raw
.
v
[
1
]
<<
" ===> "
<<
t
<<
endl
;
<<
" ===> "
<<
setfill
(
'0'
)
<<
hex
<<
setw
(
2
)
<<
t
.
hour
()
<<
":"
<<
setw
(
2
)
<<
t
.
min
()
<<
" "
<<
setw
(
2
)
<<
t
.
day
()
<<
"/"
<<
setw
(
2
)
<<
t
.
mon
()
<<
endl
;
}
}
else
if
(
!
strcmp
(
type
,
"T9"
)
)
else
if
(
!
strcmp
(
type
,
"T9"
)
)
{
{
T9
t
(
v1
,
v2
);
T9
t
(
v1
,
v2
);
cout
<<
"(T9): v1="
<<
t
.
raw
.
v
[
0
]
<<
" v2="
<<
t
.
raw
.
v
[
1
]
cout
<<
"(T9): v1="
<<
t
.
raw
.
v
[
0
]
<<
" v2="
<<
t
.
raw
.
v
[
1
]
<<
" ===> "
<<
t
<<
endl
;
<<
" ===> "
<<
setfill
(
'0'
)
<<
hex
<<
setw
(
2
)
<<
t
.
hour
()
<<
":"
<<
setw
(
2
)
<<
t
.
min
()
<<
":"
<<
setw
(
2
)
<<
t
.
sec
()
<<
"."
<<
setw
(
2
)
<<
t
.
ssec
()
<<
endl
;
}
}
else
if
(
!
strcmp
(
type
,
"T10"
)
)
else
if
(
!
strcmp
(
type
,
"T10"
)
)
{
{
T10
t
(
v1
,
v2
);
T10
t
(
v1
,
v2
);
cout
<<
"(T10): v1="
<<
t
.
raw
.
v
[
0
]
<<
" v2="
<<
t
.
raw
.
v
[
1
]
cout
<<
"(T10): v1="
<<
t
.
raw
.
v
[
0
]
<<
" v2="
<<
t
.
raw
.
v
[
1
]
<<
" ===> "
<<
t
<<
endl
;
<<
" ===> "
<<
setfill
(
'0'
)
<<
dec
<<
setw
(
4
)
<<
t
.
year
()
<<
"/"
<<
setw
(
2
)
<<
t
.
mon
()
<<
"/"
<<
setw
(
2
)
<<
t
.
day
()
<<
endl
;
}
}
else
if
(
!
strcmp
(
type
,
"F1"
)
)
else
if
(
!
strcmp
(
type
,
"F1"
)
)
{
{
...
@@ -103,7 +117,7 @@ int main( int argc, const char **argv )
...
@@ -103,7 +117,7 @@ int main( int argc, const char **argv )
cout
<<
"(F1): v1="
<<
f
.
raw
.
v
[
0
]
<<
" v2="
<<
f
.
raw
.
v
[
1
]
cout
<<
"(F1): v1="
<<
f
.
raw
.
v
[
0
]
<<
" v2="
<<
f
.
raw
.
v
[
1
]
<<
" ===> "
<<
f
.
raw
.
val
<<
endl
;
<<
" ===> "
<<
f
.
raw
.
val
<<
endl
;
}
}
else
else
{
{
cout
<<
" Unknown type: "
<<
type
<<
endl
;
cout
<<
" Unknown type: "
<<
type
<<
endl
;
return
1
;
return
1
;
...
...
extensions/ModbusMaster/mtrconv.cc
deleted
100644 → 0
View file @
9e1146c5
// --------------------------------------------------------------------------
#include <iostream>
#include <iomanip>
#include "UniSetTypes.h"
#include "MTR.h"
// --------------------------------------------------------------------------
using
namespace
std
;
using
namespace
MTR
;
// --------------------------------------------------------------------------
static
void
print_help
()
{
printf
(
"Usage: mtrconv TYPE[T1...T12,T16,T17] hex1 hex2
\n
"
);
}
// --------------------------------------------------------------------------
int
main
(
int
argc
,
const
char
**
argv
)
{
unsigned
short
v1
=
0
;
unsigned
short
v2
=
0
;
const
char
*
type
=
""
;
if
(
argc
<
2
)
{
print_help
();
return
1
;
}
type
=
argv
[
1
];
v1
=
UniSetTypes
::
uni_atoi
(
argv
[
2
]);
if
(
argc
>=
4
)
{
v1
=
UniSetTypes
::
uni_atoi
(
argv
[
3
]);
v2
=
UniSetTypes
::
uni_atoi
(
argv
[
2
]);
}
if
(
!
strcmp
(
type
,
"T1"
)
)
cout
<<
"(T1): v1="
<<
v1
<<
" --> (unsigned) "
<<
v1
<<
endl
;
else
if
(
!
strcmp
(
type
,
"T2"
)
)
cout
<<
"(T2): v1="
<<
v1
<<
" --> (signed) "
<<
(
signed
short
)
v1
<<
endl
;
else
if
(
!
strcmp
(
type
,
"T16"
)
)
{
T16
t
(
v1
);
cout
<<
"(T16): v1="
<<
t
.
val
<<
" float="
<<
t
.
fval
<<
endl
;
}
else
if
(
!
strcmp
(
type
,
"T17"
)
)
{
T17
t
(
v1
);
cout
<<
"(T17): v1="
<<
t
.
val
<<
" float="
<<
t
.
fval
<<
endl
;
}
else
if
(
!
strcmp
(
type
,
"T3"
)
)
{
T3
t
(
v1
,
v2
);
cout
<<
"(T3): v1="
<<
t
.
raw
.
v
[
0
]
<<
" v2="
<<
t
.
raw
.
v
[
1
]
<<
" --> "
<<
(
long
)
t
<<
endl
;
}
else
if
(
!
strcmp
(
type
,
"T4"
)
)
{
T4
t
(
v1
);
cout
<<
"(T4): v1="
<<
t
.
raw
<<
" --> "
<<
t
.
sval
<<
endl
;
}
else
if
(
!
strcmp
(
type
,
"T5"
)
)
{
T5
t
(
v1
,
v2
);
cout
<<
"(T5): v1="
<<
t
.
raw
.
v
[
0
]
<<
" v2="
<<
t
.
raw
.
v
[
1
]
<<
" --> "
<<
t
.
raw
.
u2
.
val
<<
" * 10^"
<<
(
int
)
t
.
raw
.
u2
.
exp
<<
" ===> "
<<
t
.
val
<<
endl
;
}
else
if
(
!
strcmp
(
type
,
"T6"
)
)
{
T6
t
(
v1
,
v2
);
cout
<<
"(T6): v1="
<<
t
.
raw
.
v
[
0
]
<<
" v2="
<<
t
.
raw
.
v
[
1
]
<<
" --> "
<<
t
.
raw
.
u2
.
val
<<
" * 10^"
<<
(
int
)
t
.
raw
.
u2
.
exp
<<
" ===> "
<<
t
.
val
<<
endl
;
}
else
if
(
!
strcmp
(
type
,
"T7"
)
)
{
T7
t
(
v1
,
v2
);
cout
<<
"(T7): v1="
<<
t
.
raw
.
v
[
0
]
<<
" v2="
<<
t
.
raw
.
v
[
1
]
// << " --> " << T7.val << " * 10^-4"
<<
" ===> "
<<
t
.
val
<<
" ["
<<
(
t
.
raw
.
u2
.
ic
==
0xFF
?
"CAP"
:
"IND"
)
<<
"|"
<<
(
t
.
raw
.
u2
.
ie
==
0xFF
?
"EXP"
:
"IMP"
)
<<
"]"
<<
endl
;
}
else
if
(
!
strcmp
(
type
,
"T8"
)
)
{
T8
t
(
v1
,
v2
);
cout
<<
"(T8): v1="
<<
t
.
raw
.
v
[
0
]
<<
" v2="
<<
t
.
raw
.
v
[
1
]
<<
" ===> "
<<
setfill
(
'0'
)
<<
hex
<<
setw
(
2
)
<<
t
.
hour
()
<<
":"
<<
setw
(
2
)
<<
t
.
min
()
<<
" "
<<
setw
(
2
)
<<
t
.
day
()
<<
"/"
<<
setw
(
2
)
<<
t
.
mon
()
<<
endl
;
}
else
if
(
!
strcmp
(
type
,
"T9"
)
)
{
T9
t
(
v1
,
v2
);
cout
<<
"(T9): v1="
<<
t
.
raw
.
v
[
0
]
<<
" v2="
<<
t
.
raw
.
v
[
1
]
<<
" ===> "
<<
setfill
(
'0'
)
<<
hex
<<
setw
(
2
)
<<
t
.
hour
()
<<
":"
<<
setw
(
2
)
<<
t
.
min
()
<<
":"
<<
setw
(
2
)
<<
t
.
sec
()
<<
"."
<<
setw
(
2
)
<<
t
.
ssec
()
<<
endl
;
}
else
if
(
!
strcmp
(
type
,
"T10"
)
)
{
T10
t
(
v1
,
v2
);
cout
<<
"(T10): v1="
<<
t
.
raw
.
v
[
0
]
<<
" v2="
<<
t
.
raw
.
v
[
1
]
<<
" ===> "
<<
setfill
(
'0'
)
<<
dec
<<
setw
(
4
)
<<
t
.
year
()
<<
"/"
<<
setw
(
2
)
<<
t
.
mon
()
<<
"/"
<<
setw
(
2
)
<<
t
.
day
()
<<
endl
;
}
else
if
(
!
strcmp
(
type
,
"F1"
)
)
{
F1
f
(
v1
,
v2
);
cout
<<
"(F1): v1="
<<
f
.
raw
.
v
[
0
]
<<
" v2="
<<
f
.
raw
.
v
[
1
]
<<
" ===> "
<<
f
.
raw
.
val
<<
endl
;
}
else
{
cout
<<
" Unknown type: "
<<
type
<<
endl
;
return
1
;
}
return
0
;
}
// --------------------------------------------------------------------------
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