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
d1530a2b
Commit
d1530a2b
authored
Feb 11, 2011
by
Pavel Vainerman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Сделал "грубую", но работающую инициализаию регистров
parent
d341c2a9
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
33 additions
and
11 deletions
+33
-11
MBTCPMaster.cc
extensions/MBTCPMaster/MBTCPMaster.cc
+0
-0
MBTCPMaster.h
extensions/MBTCPMaster/MBTCPMaster.h
+30
-8
Makefile.am
extensions/MBTCPMaster/Makefile.am
+1
-1
libUniSetMBTCPMaster.pc.in
extensions/MBTCPMaster/libUniSetMBTCPMaster.pc.in
+1
-1
RTUExchange.cc
extensions/RTUExchange/RTUExchange.cc
+1
-1
No files found.
extensions/MBTCPMaster/MBTCPMaster.cc
View file @
d1530a2b
This diff is collapsed.
Click to expand it.
extensions/MBTCPMaster/MBTCPMaster.h
View file @
d1530a2b
...
...
@@ -87,7 +87,7 @@
- 1 - перечитывать значения входов из SharedMemory на каждом цикле
- 0 - обновлять значения только по изменению
\b --xxx-
force-disconnect или \b force_disconnect -
закрывать соединение после каждого запроса.
\b --xxx-
persistent-connection или \b persistent_connection - НЕ
закрывать соединение после каждого запроса.
\b --xxx-force-out или \b force_out [1|0]
- 1 - перечитывать значения выходов из SharedMemory на каждом цикле
...
...
@@ -220,8 +220,7 @@ class MBTCPMaster:
RegInfo
()
:
mbval
(
0
),
mbreg
(
0
),
mbfunc
(
ModbusRTU
::
fnUnknown
),
dev
(
0
),
offset
(
0
),
mtrType
(
MTR
::
mtUnknown
),
q_num
(
0
),
q_count
(
1
),
mb_init
(
false
),
sm_init
(
false
),
mb_init_mbreg
(
0
)
q_num
(
0
),
q_count
(
1
),
sm_init
(
false
),
mb_init
(
false
)
{}
ModbusRTU
::
ModbusData
mbval
;
...
...
@@ -241,9 +240,10 @@ class MBTCPMaster:
int
q_count
;
/*!< count registers for query */
RegMap
::
iterator
rit
;
bool
mb_init
;
/*!< init before use */
bool
sm_init
;
/*!< SM init value */
ModbusRTU
::
ModbusData
mb_init_mbreg
;
/*!< mb_init register */
// начальная инициалиазция
bool
sm_init
;
/*!< что инициализировалось ли значение в SM */
bool
mb_init
;
/*!< требуется или нет */
};
friend
std
::
ostream
&
operator
<<
(
std
::
ostream
&
os
,
RegInfo
&
r
);
...
...
@@ -293,9 +293,30 @@ class MBTCPMaster:
void
printMap
(
RTUDeviceMap
&
d
);
// ----------------------------------
protected
:
struct
InitRegInfo
{
InitRegInfo
()
:
dev
(
0
),
mbreg
(
0
),
mbfunc
(
ModbusRTU
::
fnUnknown
),
initOK
(
false
),
ri
(
0
)
{}
RSProperty
p
;
RTUDevice
*
dev
;
ModbusRTU
::
ModbusData
mbreg
;
ModbusRTU
::
SlaveFunctionCode
mbfunc
;
bool
initOK
;
RegInfo
*
ri
;
};
typedef
std
::
list
<
InitRegInfo
>
InitList
;
void
firstInitRegisters
();
bool
preInitRead
(
InitList
::
iterator
&
p
);
bool
initSMValue
(
ModbusRTU
::
ModbusData
*
data
,
int
count
,
RSProperty
*
p
);
bool
allInitOK
;
RTUDeviceMap
rmap
;
InitList
initRegList
;
/*!< список регистров для инициализации */
ModbusTCPMaster
*
mb
;
UniSetTypes
::
uniset_mutex
mbMutex
;
std
::
string
iaddr
;
...
...
@@ -355,7 +376,8 @@ class MBTCPMaster:
void
readConfiguration
();
bool
check_item
(
UniXML_iterator
&
it
);
private
:
private
:
MBTCPMaster
();
bool
initPause
;
UniSetTypes
::
uniset_mutex
mutex_start
;
...
...
extensions/MBTCPMaster/Makefile.am
View file @
d1530a2b
bin_PROGRAMS
=
@PACKAGE@-mbtcpmaster
# не забывайте править версию в pc-файле
UMBTCP_VER
=
@LIBVER@
UMBTCP_VER
=
1:1:0
lib_LTLIBRARIES
=
libUniSetMBTCPMaster.la
libUniSetMBTCPMaster_la_LDFLAGS
=
-version-info
$(UMBTCP_VER)
...
...
extensions/MBTCPMaster/libUniSetMBTCPMaster.pc.in
View file @
d1530a2b
...
...
@@ -6,6 +6,6 @@ includedir=@includedir@
Name: libUniSetMBTCPMaster
Description: Support library for UniSetModbusTCPMaster
Requires: libUniSetExtensions libUniSetSharedMemory
Version:
@VERSION@
Version:
1.1.0
Libs: -L${libdir} -lUniSetMBTCPMaster
Cflags: -I${includedir}/uniset
extensions/RTUExchange/RTUExchange.cc
View file @
d1530a2b
...
...
@@ -607,7 +607,7 @@ void RTUExchange::updateSM()
if
(
dlog
.
debugging
(
Debug
::
LEVEL4
)
)
{
dlog
[
Debug
::
LEVEL4
]
<<
"check respond addr="
<<
ModbusRTU
::
addr2str
(
d
->
mbaddr
)
<<
" respond="
<<
d
->
resp_id
<<
" respond
_id
="
<<
d
->
resp_id
<<
" real="
<<
d
->
resp_real
<<
" state="
<<
d
->
resp_state
<<
endl
;
...
...
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