Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
P
PastureGateway
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
steven.sha
PastureGateway
Commits
0b293b14
Commit
0b293b14
authored
May 30, 2019
by
leon.huang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add one pools Data and Control
parent
7f3365ba
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
268 additions
and
64 deletions
+268
-64
ModbusToPool.cs
ModbusDemo/application/ModbusToPool.cs
+54
-2
PoolModbusSet.cs
ModbusDemo/application/PoolModbusSet.cs
+214
-62
No files found.
ModbusDemo/application/ModbusToPool.cs
View file @
0b293b14
...
@@ -27,9 +27,10 @@ namespace ModbusDemo.application
...
@@ -27,9 +27,10 @@ namespace ModbusDemo.application
this
.
bOpenStatus
[
i
]
=
bInitOPen
[
i
];
this
.
bOpenStatus
[
i
]
=
bInitOPen
[
i
];
}
}
}
}
public
void
vGet_Module_Channel_Status
()
public
bool
[]
vGet_Module_Channel_Status
()
{
{
ModbusComm
.
Modbus_ReadCoilsTask
(
out
this
.
bGetStatus
,
this
.
byModbusID
,
this
.
usRegAddList
[
0
],
(
ushort
)
this
.
usRegAddList
.
Length
,
out
this
.
bCommunicationStatus
);
ModbusComm
.
Modbus_ReadCoilsTask
(
out
this
.
bGetStatus
,
this
.
byModbusID
,
this
.
usRegAddList
[
0
],
(
ushort
)
this
.
usRegAddList
.
Length
,
out
this
.
bCommunicationStatus
);
return
this
.
bGetStatus
;
}
}
public
void
vSet_Module_Channel_Status
()
public
void
vSet_Module_Channel_Status
()
{
{
...
@@ -52,9 +53,60 @@ namespace ModbusDemo.application
...
@@ -52,9 +53,60 @@ namespace ModbusDemo.application
}
}
}
}
public
void
vRead_Pumb_Data
()
public
double
vRead_Pumb_Data
()
{
ModbusComm
.
Modbus_ReadHoldingRegistersTask
(
out
this
.
usReadData
,
this
.
byModbusID
,
this
.
usRegAddList
[
0
],
(
ushort
)
this
.
usRegAddList
.
Length
,
out
this
.
bCommunicationStatus
);
return
this
.
usReadData
[
0
];
}
}
public
class
pcModbusOperationAgitator
{
public
byte
byModbusID
;
public
ushort
[]
usRegAddList
;
public
bool
[]
bGetStatus
;
public
bool
[]
bSetStatus
;
public
bool
[]
bOpenStatus
;
public
bool
bCommunicationStatus
;
public
pcModbusOperationAgitator
(
byte
byInitModbusID
,
ushort
[]
usInitRegAddressInit
,
bool
[]
bInitOPen
)
{
this
.
byModbusID
=
byInitModbusID
;
for
(
int
i
=
0
;
i
<
usInitRegAddressInit
.
Length
;
i
++)
{
this
.
usRegAddList
[
i
]
=
usInitRegAddressInit
[
i
];
this
.
bOpenStatus
[
i
]
=
bInitOPen
[
i
];
}
}
public
bool
[]
vGet_Module_Channel_Status
()
{
ModbusComm
.
Modbus_ReadCoilsTask
(
out
this
.
bGetStatus
,
this
.
byModbusID
,
this
.
usRegAddList
[
0
],
(
ushort
)
this
.
usRegAddList
.
Length
,
out
this
.
bCommunicationStatus
);
return
this
.
bGetStatus
;
}
public
void
vSet_Module_Channel_Status
()
{
ModbusComm
.
Modbus_WriteMultipleCoils
(
this
.
byModbusID
,
this
.
usRegAddList
[
0
],
this
.
bSetStatus
,
out
this
.
bCommunicationStatus
);
}
}
public
class
pcReadAgitatorOtherData
{
public
byte
byModbusID
;
public
ushort
[]
usRegAddList
;
public
ushort
[]
usReadData
;
public
bool
bCommunicationStatus
;
public
pcReadAgitatorOtherData
(
byte
byInitModbusID
,
ushort
[]
usInitRegAddressInit
)
{
this
.
byModbusID
=
byInitModbusID
;
for
(
int
i
=
0
;
i
<
usInitRegAddressInit
.
Length
;
i
++)
{
this
.
usRegAddList
[
i
]
=
usInitRegAddressInit
[
i
];
}
}
public
double
vRead_Agitator_Data
()
{
{
ModbusComm
.
Modbus_ReadHoldingRegistersTask
(
out
this
.
usReadData
,
this
.
byModbusID
,
this
.
usRegAddList
[
0
],
(
ushort
)
this
.
usRegAddList
.
Length
,
out
this
.
bCommunicationStatus
);
ModbusComm
.
Modbus_ReadHoldingRegistersTask
(
out
this
.
usReadData
,
this
.
byModbusID
,
this
.
usRegAddList
[
0
],
(
ushort
)
this
.
usRegAddList
.
Length
,
out
this
.
bCommunicationStatus
);
return
this
.
usReadData
[
0
];
}
}
}
}
...
...
ModbusDemo/application/PoolModbusSet.cs
View file @
0b293b14
This diff is collapsed.
Click to expand it.
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