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
6e241f93
Commit
6e241f93
authored
Jun 19, 2019
by
leon.huang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add inturrupt close
parent
f07825d9
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
317 additions
and
711 deletions
+317
-711
ModualAlarm.cs
ModbusDemo/Common/ModualAlarm.cs
+1
-1
ModbusComm.cs
ModbusDemo/MessageFormat/ModbusComm.cs
+0
-21
ModualControl.cs
ModbusDemo/MessageFormat/ModualControl.cs
+37
-104
ModbusDemo.csproj
ModbusDemo/ModbusDemo.csproj
+6
-8
ModualPoll.cs
ModbusDemo/Modular/ModualPoll.cs
+1
-1
modual.cs
ModbusDemo/Modular/modual.cs
+0
-2
AllPond.cs
ModbusDemo/application/AllPond.cs
+85
-73
ControlMap.cs
ModbusDemo/application/ControlMap.cs
+82
-8
ModualPool.cs
ModbusDemo/application/ModualPool.cs
+101
-35
PoolModbusSet.cs
ModbusDemo/application/PoolModbusSet.cs
+0
-400
UsThread.cs
ModbusDemo/application/UsThread.cs
+0
-12
Form1.cs
ModbusDemo/windows/Form1.cs
+4
-46
No files found.
ModbusDemo/Common/ModualAlarm.cs
View file @
6e241f93
...
@@ -26,6 +26,7 @@ namespace ModbusDemo.Common
...
@@ -26,6 +26,7 @@ namespace ModbusDemo.Common
ChannelDataChangeError
=
8
,
ChannelDataChangeError
=
8
,
ChannelLevelError
=
16
,
ChannelLevelError
=
16
,
ChannelControlError
=
32
,
ChannelControlError
=
32
,
ChannelRunOverTimeError
=
64
,
}
}
public
static
void
vSetAlarmList
(
ushort
usAddress
,
ushort
[]
usChannel
,
ushort
[]
usChannelAlarmcode
)
public
static
void
vSetAlarmList
(
ushort
usAddress
,
ushort
[]
usChannel
,
ushort
[]
usChannelAlarmcode
)
{
{
...
@@ -56,7 +57,6 @@ namespace ModbusDemo.Common
...
@@ -56,7 +57,6 @@ namespace ModbusDemo.Common
.
Build
();
.
Build
();
await
mqttClient
.
PublishAsync
(
message
);
await
mqttClient
.
PublishAsync
(
message
);
}
}
public
static
void
vSet_Modual_Alarm
(
byte
byModbusID
,
ushort
usAlarmCodde
,
bool
bSetAlarm
,
byte
byCommFailTimes
,
params
string
[]
strChannalList
)
public
static
void
vSet_Modual_Alarm
(
byte
byModbusID
,
ushort
usAlarmCodde
,
bool
bSetAlarm
,
byte
byCommFailTimes
,
params
string
[]
strChannalList
)
{
{
for
(
int
i
=
0
;
i
<
ModualPoll
.
byX14pNumber
;
i
++)
for
(
int
i
=
0
;
i
<
ModualPoll
.
byX14pNumber
;
i
++)
...
...
ModbusDemo/MessageFormat/ModbusComm.cs
View file @
6e241f93
...
@@ -28,20 +28,11 @@ namespace ModbusDemo.MessageFormat
...
@@ -28,20 +28,11 @@ namespace ModbusDemo.MessageFormat
MB_EMASTERSENT
,
MB_EMASTERSENT
,
MB_RTUERNOERR
MB_RTUERNOERR
}
}
<<<<<<<
HEAD
public
static
ModbusMaster
Modbus
;
public
static
ushort
usCommunFailTimes
=
0
;
private
static
object
oLock
=
new
object
();
public
static
eModbusErrorCode
Modbus_ReadHoldingRegistersTask
(
out
ushort
[]
OutputValue
,
byte
slaveAddress
,
ushort
startAddress
,
ushort
numberOfPoints
)
{
=======
public
static
ModbusMaster
Modbus
;
public
static
ModbusMaster
Modbus
;
public
static
ushort
usCommunFailTimes
=
0
;
public
static
ushort
usCommunFailTimes
=
0
;
static
object
oLock
=
new
object
();
static
object
oLock
=
new
object
();
public
static
eModbusErrorCode
Modbus_ReadHoldingRegistersTask
(
out
ushort
[]
OutputValue
,
byte
slaveAddress
,
ushort
startAddress
,
ushort
numberOfPoints
)
public
static
eModbusErrorCode
Modbus_ReadHoldingRegistersTask
(
out
ushort
[]
OutputValue
,
byte
slaveAddress
,
ushort
startAddress
,
ushort
numberOfPoints
)
{
{
>>>>>>>
5635
bdf708c90bb2146f99466d1145dda5dabb37
lock
(
oLock
)
lock
(
oLock
)
{
{
eModbusErrorCode
ModbusErrorCode
;
eModbusErrorCode
ModbusErrorCode
;
...
@@ -126,10 +117,6 @@ namespace ModbusDemo.MessageFormat
...
@@ -126,10 +117,6 @@ namespace ModbusDemo.MessageFormat
}
}
public
static
eModbusErrorCode
Modbus_ReadCoilsTask
(
out
bool
[]
OutputValue
,
byte
slaveAddress
,
ushort
startAddress
,
ushort
numberOfPoints
)
public
static
eModbusErrorCode
Modbus_ReadCoilsTask
(
out
bool
[]
OutputValue
,
byte
slaveAddress
,
ushort
startAddress
,
ushort
numberOfPoints
)
{
{
<<<<<<<
HEAD
=======
//object oLock = new object();
>>>>>>>
5635
bdf708c90bb2146f99466d1145dda5dabb37
lock
(
oLock
)
lock
(
oLock
)
{
{
eModbusErrorCode
ModbusErrorCode
;
eModbusErrorCode
ModbusErrorCode
;
...
@@ -214,10 +201,6 @@ namespace ModbusDemo.MessageFormat
...
@@ -214,10 +201,6 @@ namespace ModbusDemo.MessageFormat
}
}
public
static
eModbusErrorCode
Modbus_WriteSingleCoil
(
byte
slaveAddress
,
ushort
startAddress
,
bool
value
)
public
static
eModbusErrorCode
Modbus_WriteSingleCoil
(
byte
slaveAddress
,
ushort
startAddress
,
bool
value
)
{
{
<<<<<<<
HEAD
=======
//object oLock = new object();
>>>>>>>
5635
bdf708c90bb2146f99466d1145dda5dabb37
lock
(
oLock
)
lock
(
oLock
)
{
{
eModbusErrorCode
ModbusErrorCode
;
eModbusErrorCode
ModbusErrorCode
;
...
@@ -300,10 +283,6 @@ namespace ModbusDemo.MessageFormat
...
@@ -300,10 +283,6 @@ namespace ModbusDemo.MessageFormat
}
}
public
static
eModbusErrorCode
Modbus_WriteMultipleCoils
(
byte
slaveAddress
,
ushort
startAddress
,
bool
[]
data
)
public
static
eModbusErrorCode
Modbus_WriteMultipleCoils
(
byte
slaveAddress
,
ushort
startAddress
,
bool
[]
data
)
{
{
<<<<<<<
HEAD
=======
//object oLock = new object();
>>>>>>>
5635
bdf708c90bb2146f99466d1145dda5dabb37
lock
(
oLock
)
lock
(
oLock
)
{
{
eModbusErrorCode
ModbusErrorCode
;
eModbusErrorCode
ModbusErrorCode
;
...
...
ModbusDemo/MessageFormat/ModualControl.cs
View file @
6e241f93
This diff is collapsed.
Click to expand it.
ModbusDemo/ModbusDemo.csproj
View file @
6e241f93
...
@@ -91,10 +91,8 @@
...
@@ -91,10 +91,8 @@
<Compile
Include=
"application\AutoControl.cs"
/>
<Compile
Include=
"application\AutoControl.cs"
/>
<Compile
Include=
"application\ControlMap.cs"
/>
<Compile
Include=
"application\ControlMap.cs"
/>
<Compile
Include=
"application\InIHelper.cs"
/>
<Compile
Include=
"application\InIHelper.cs"
/>
<Compile
Include=
"application\PoolModbusSet.cs"
/>
<Compile
Include=
"application\ModualPool.cs"
/>
<Compile
Include=
"application\ModualPool.cs"
/>
<Compile
Include=
"application\AllPond.cs"
/>
<Compile
Include=
"application\AllPond.cs"
/>
<Compile
Include=
"application\UsThread.cs"
/>
<Compile
Include=
"Common\ModualAlarm.cs"
/>
<Compile
Include=
"Common\ModualAlarm.cs"
/>
<Compile
Include=
"Common\OperIni.cs"
/>
<Compile
Include=
"Common\OperIni.cs"
/>
<Compile
Include=
"MessageFormat\ModualControl.cs"
/>
<Compile
Include=
"MessageFormat\ModualControl.cs"
/>
...
@@ -180,15 +178,15 @@
...
@@ -180,15 +178,15 @@
</PropertyGroup>
</PropertyGroup>
<Import
Project=
"$(SQLDBExtensionsRefPath)\Microsoft.Data.Tools.Schema.Sql.UnitTesting.targets"
Condition=
"$(VisualStudioVersion) != '15.0' And '$(SQLDBExtensionsRefPath)' != ''"
/>
<Import
Project=
"$(SQLDBExtensionsRefPath)\Microsoft.Data.Tools.Schema.Sql.UnitTesting.targets"
Condition=
"$(VisualStudioVersion) != '15.0' And '$(SQLDBExtensionsRefPath)' != ''"
/>
<Import
Project=
"$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\SSDT\Microsoft.Data.Tools.Schema.Sql.UnitTesting.targets"
Condition=
"$(VisualStudioVersion) != '15.0' And '$(SQLDBExtensionsRefPath)' == ''"
/>
<Import
Project=
"$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\SSDT\Microsoft.Data.Tools.Schema.Sql.UnitTesting.targets"
Condition=
"$(VisualStudioVersion) != '15.0' And '$(SQLDBExtensionsRefPath)' == ''"
/>
<<<<<<
< HEAD
<!-- <<<<<<< HEAD -->
<<<<<<<
HEAD
<!-- <<<<<<< HEAD -->
=
======
<!-- ======= -->
=======
<!-- ======= -->
>
>>>>>> 5635bdf708c90bb2146f99466d1145dda5dabb37
<!-- >>>>>>> 5635bdf708c90bb2146f99466d1145dda5dabb37 -->
<PropertyGroup>
<PropertyGroup>
<SsdtUnitTestVersion>
3.1
</SsdtUnitTestVersion>
<SsdtUnitTestVersion>
3.1
</SsdtUnitTestVersion>
</PropertyGroup>
</PropertyGroup>
>>>>>>> origin/master
<!-- >>>>>>> origin/master -->
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
<Target Name="BeforeBuild">
...
...
ModbusDemo/Modular/ModualPoll.cs
View file @
6e241f93
...
@@ -36,7 +36,7 @@ namespace ModbusDemo.Modular
...
@@ -36,7 +36,7 @@ namespace ModbusDemo.Modular
#if DEBUG_TEST
#if DEBUG_TEST
public
const
byte
byX18xNumber
=
1
;
public
const
byte
byX18xNumber
=
1
;
public
static
byte
[]
byX18xIdlist
=
{
13
};
public
static
byte
[]
byX18xIdlist
=
{
13
};
private
static
modual
.
eX18xSensorChannelType
[,]
sX18xChannelType
=
new
modual
.
eX18xSensorChannelType
[
byX18xNumber
,
byX18xReadDataNumber
]
{
{
modual
.
eX18xSensorChannelType
.
Mike_6
,
modual
.
eX18xSensorChannelType
.
Null
,
modual
.
eX18xSensorChannelType
.
NormalCurrent
,
modual
.
eX18xSensorChannelType
.
Null
,
modual
.
eX18xSensorChannelType
.
Null
,
modual
.
eX18xSensorChannelType
.
Null
,
modual
.
eX18xSensorChannelType
.
Null
,
modual
.
eX18xSensorChannelType
.
Null
}
};
private
static
modual
.
eX18xSensorChannelType
[,]
sX18xChannelType
=
new
modual
.
eX18xSensorChannelType
[
byX18xNumber
,
byX18xReadDataNumber
]
{
{
modual
.
eX18xSensorChannelType
.
NormalCurrent
,
modual
.
eX18xSensorChannelType
.
Null
,
modual
.
eX18xSensorChannelType
.
NormalCurrent
,
modual
.
eX18xSensorChannelType
.
Null
,
modual
.
eX18xSensorChannelType
.
Null
,
modual
.
eX18xSensorChannelType
.
Null
,
modual
.
eX18xSensorChannelType
.
Null
,
modual
.
eX18xSensorChannelType
.
Null
}
};
#else
#else
public
const
byte
byX18xNumber
=
6
;
public
const
byte
byX18xNumber
=
6
;
public
static
byte
[]
byX18xIdlist
=
{
3
,
53
,
6
,
12
,
21
,
25
};
public
static
byte
[]
byX18xIdlist
=
{
3
,
53
,
6
,
12
,
21
,
25
};
...
...
ModbusDemo/Modular/modual.cs
View file @
6e241f93
...
@@ -89,8 +89,6 @@ namespace ModbusDemo.Modular
...
@@ -89,8 +89,6 @@ namespace ModbusDemo.Modular
{
{
this
.
sX18xDataStruct
[
i
].
dBeforeConvertData
=
new
double
[
ModualPoll
.
byX18xReadDataNumber
];
this
.
sX18xDataStruct
[
i
].
dBeforeConvertData
=
new
double
[
ModualPoll
.
byX18xReadDataNumber
];
this
.
sX18xDataStruct
[
i
].
dNowConvertData
=
new
double
[
ModualPoll
.
byX18xReadDataNumber
];
this
.
sX18xDataStruct
[
i
].
dNowConvertData
=
new
double
[
ModualPoll
.
byX18xReadDataNumber
];
//this.sX18xDataStruct[i].usRegData = new ushort[ModualPoll.byX18xReadDataNumber];
//this.sX18xDataStruct[i].usTypeData = new ushort[ModualPoll.byX18xReadDataNumber];
this
.
sX18xAlarmstruct
[
i
].
usBeforeAlarmCode
=
new
ushort
[
ModualPoll
.
byX18xReadDataNumber
];
this
.
sX18xAlarmstruct
[
i
].
usBeforeAlarmCode
=
new
ushort
[
ModualPoll
.
byX18xReadDataNumber
];
this
.
sX18xAlarmstruct
[
i
].
usNowAlarmCode
=
new
ushort
[
ModualPoll
.
byX18xReadDataNumber
];
this
.
sX18xAlarmstruct
[
i
].
usNowAlarmCode
=
new
ushort
[
ModualPoll
.
byX18xReadDataNumber
];
this
.
sX18xAlarmstruct
[
i
].
usCommFailTimes
=
new
ushort
[
ModualPoll
.
byX18xReadDataNumber
];
this
.
sX18xAlarmstruct
[
i
].
usCommFailTimes
=
new
ushort
[
ModualPoll
.
byX18xReadDataNumber
];
...
...
ModbusDemo/application/AllPond.cs
View file @
6e241f93
...
@@ -8,20 +8,19 @@ using ModbusDemo;
...
@@ -8,20 +8,19 @@ using ModbusDemo;
using
ModbusDemo.application
;
using
ModbusDemo.application
;
namespace
ModbusDemo.application
namespace
ModbusDemo.application
{
{
public
static
class
AllPond
public
static
class
AllPond
{
{
private
static
ModualPool
.
pcTemperature
cEastTransitPoolTemper
=
new
ModualPool
.
pcTemperature
(
"EastTransitPoolTemper"
,
27
,
"d0"
);
private
static
ModualPool
.
pcTemperature
cEastTransitPoolTemper
=
new
ModualPool
.
pcTemperature
(
"EastTransitPoolTemper"
,
27
,
"d0"
);
private
static
ModualPool
.
pcLiquidlevel
cEastTransitPoolLevel
=
new
ModualPool
.
pcLiquidlevel
(
"EastTransitPoolLevel"
,
13
,
"d0"
);
private
static
ModualPool
.
pcLiquidlevel
cEastTransitPoolLevel
=
new
ModualPool
.
pcLiquidlevel
(
"EastTransitPoolLevel"
,
13
,
"d0"
);
private
static
ModualPool
.
pcOperation
cEastTransitPoolSouthWaterBase
=
new
ModualPool
.
pcOperation
private
static
ModualPool
.
pcOperation
cEastTransitPoolSouthWaterBase
=
new
ModualPool
.
pcOperation
{
{
byModbusID
=
16
,
byModbusID
=
31
,
strOperationNumber
=
"d0
"
,
strOperationNumber
=
"d1
"
,
strChannelNumber
=
new
string
[]
{
"d0"
,
"d1
"
},
strChannelNumber
=
new
string
[]
{
"d1"
,
"d2
"
},
bOpenOperation
=
new
bool
[]
{
true
,
true
},
bOpenOperation
=
new
bool
[]
{
true
,
true
},
bCloseOperation
=
new
bool
[]
{
false
,
false
},
bCloseOperation
=
new
bool
[]
{
false
,
false
},
bHadRefControl
=
false
,
bHadRefControl
=
false
,
byResModbusID
=
0xFF
,
byResModbusID
=
0
,
strResChannelNumber
=
null
strResChannelNumber
=
null
};
};
private
static
ModualPool
.
pcMachine
cEastTransitPoolSouthWater
=
new
ModualPool
.
pcMachine
(
"EastTransitPoolSouthWater"
,
cEastTransitPoolSouthWaterBase
);
private
static
ModualPool
.
pcMachine
cEastTransitPoolSouthWater
=
new
ModualPool
.
pcMachine
(
"EastTransitPoolSouthWater"
,
cEastTransitPoolSouthWaterBase
);
...
@@ -29,8 +28,8 @@ namespace ModbusDemo.application
...
@@ -29,8 +28,8 @@ namespace ModbusDemo.application
private
static
ModualPool
.
pcOperation
cEastTransitPoolNorthWaterBase
=
new
ModualPool
.
pcOperation
private
static
ModualPool
.
pcOperation
cEastTransitPoolNorthWaterBase
=
new
ModualPool
.
pcOperation
{
{
byModbusID
=
16
,
byModbusID
=
16
,
strOperationNumber
=
"d2
"
,
strOperationNumber
=
"d0
"
,
strChannelNumber
=
new
string
[]
{
"d2"
,
"d3
"
},
strChannelNumber
=
new
string
[]
{
"d0"
,
"d1
"
},
bOpenOperation
=
new
bool
[]
{
true
,
true
},
bOpenOperation
=
new
bool
[]
{
true
,
true
},
bCloseOperation
=
new
bool
[]
{
false
,
false
},
bCloseOperation
=
new
bool
[]
{
false
,
false
},
bHadRefControl
=
false
,
bHadRefControl
=
false
,
...
@@ -42,60 +41,61 @@ namespace ModbusDemo.application
...
@@ -42,60 +41,61 @@ namespace ModbusDemo.application
private
static
ModualPool
.
pcOperation
cEastTransitPoolPumb1Base
=
new
ModualPool
.
pcOperation
private
static
ModualPool
.
pcOperation
cEastTransitPoolPumb1Base
=
new
ModualPool
.
pcOperation
{
{
byModbusID
=
16
,
byModbusID
=
16
,
strOperationNumber
=
"d0
"
,
strOperationNumber
=
"d2
"
,
strChannelNumber
=
new
string
[]
{
"d0"
,
"d1"
},
strChannelNumber
=
new
string
[]
{
"d2"
,
"d3"
},
bOpenOperation
=
new
bool
[]
{
true
,
true
},
bOpenOperation
=
new
bool
[]
{
true
,
true
},
bCloseOperation
=
new
bool
[]
{
false
,
false
},
bCloseOperation
=
new
bool
[]
{
false
,
false
},
bHadRefControl
=
false
,
bHadRefControl
=
false
,
byResModbusID
=
0xFF
,
byResModbusID
=
0
,
strResChannelNumber
=
null
strResChannelNumber
=
null
};
};
private
static
ModualPool
.
pcMachine
cEastTransitPoolPumb1
=
new
ModualPool
.
pcMachine
(
"EastTransitPoolPumb_1"
,
cEastTransitPoolPumb1Base
);
private
static
ModualPool
.
pcMachine
cEastTransitPoolPumb1
=
new
ModualPool
.
pcMachine
(
"EastTransitPoolPumb_1"
,
cEastTransitPoolPumb1Base
);
private
static
ModualPool
.
pcOperation
cEastTransitPoolPumb2Base
=
new
ModualPool
.
pcOperation
private
static
ModualPool
.
pcOperation
cEastTransitPoolPumb2Base
=
new
ModualPool
.
pcOperation
{
{
byModbusID
=
16
,
byModbusID
=
35
,
strOperationNumber
=
"d0"
,
strOperationNumber
=
"d0"
,
strChannelNumber
=
new
string
[]
{
"d0"
,
"d1"
},
strChannelNumber
=
new
string
[]
{
"d0"
,
"d1"
},
bOpenOperation
=
new
bool
[]
{
true
,
true
},
bOpenOperation
=
new
bool
[]
{
true
,
true
},
bCloseOperation
=
new
bool
[]
{
false
,
false
},
bCloseOperation
=
new
bool
[]
{
false
,
true
},
bHadRefControl
=
false
,
bHadRefControl
=
false
,
byResModbusID
=
0xFF
,
byResModbusID
=
0
,
strResChannelNumber
=
null
strResChannelNumber
=
null
};
};
private
static
ModualPool
.
pcMachine
cEastTransitPoolPumb2
=
new
ModualPool
.
pcMachine
(
"EastTransitPoolPumb_2"
,
cEastTransitPoolPumb2Base
);
private
static
ModualPool
.
pcMachine
cEastTransitPoolPumb2
=
new
ModualPool
.
pcMachine
(
"EastTransitPoolPumb_2"
,
cEastTransitPoolPumb2Base
);
private
static
ModualPool
.
pcOperation
cEastTransitPoolStirrer1Base
=
new
ModualPool
.
pcOperation
private
static
ModualPool
.
pcOperation
cEastTransitPoolStirrer1Base
=
new
ModualPool
.
pcOperation
{
{
byModbusID
=
16
,
byModbusID
=
35
,
strOperationNumber
=
"d0
"
,
strOperationNumber
=
"d2
"
,
strChannelNumber
=
new
string
[]
{
"d0"
,
"d1
"
},
strChannelNumber
=
new
string
[]
{
"d2"
,
"d3
"
},
bOpenOperation
=
new
bool
[]
{
true
,
true
},
bOpenOperation
=
new
bool
[]
{
true
,
true
},
bCloseOperation
=
new
bool
[]
{
false
,
false
},
bCloseOperation
=
new
bool
[]
{
false
,
false
},
bHadRefControl
=
false
,
bHadRefControl
=
false
,
byResModbusID
=
0xFF
,
byResModbusID
=
0
,
strResChannelNumber
=
null
strResChannelNumber
=
null
};
};
private
static
ModualPool
.
pcMachine
cEastTransitPoolStirrer1
=
new
ModualPool
.
pcMachine
(
"EastTransitPoolStirrer_1"
,
cEastTransitPoolStirrer1Base
);
private
static
ModualPool
.
pcMachine
cEastTransitPoolStirrer1
=
new
ModualPool
.
pcMachine
(
"EastTransitPoolStirrer_1"
,
cEastTransitPoolStirrer1Base
);
private
static
ModualPool
.
pcOperation
cEastTransitPoolStirrer2Base
=
new
ModualPool
.
pcOperation
private
static
ModualPool
.
pcOperation
cEastTransitPoolStirrer2Base
=
new
ModualPool
.
pcOperation
{
{
byModbusID
=
16
,
byModbusID
=
39
,
strOperationNumber
=
"d0"
,
strOperationNumber
=
"d0"
,
strChannelNumber
=
new
string
[]
{
"d0"
,
"d1"
},
strChannelNumber
=
new
string
[]
{
"d0"
,
"d1"
},
bOpenOperation
=
new
bool
[]
{
true
,
true
},
bOpenOperation
=
new
bool
[]
{
true
,
true
},
bCloseOperation
=
new
bool
[]
{
false
,
false
},
bCloseOperation
=
new
bool
[]
{
false
,
false
},
bHadRefControl
=
fals
e
,
bHadRefControl
=
tru
e
,
byResModbusID
=
0xFF
,
byResModbusID
=
13
,
strResChannelNumber
=
null
strResChannelNumber
=
"d0"
};
};
private
static
ModualPool
.
pcMachine
cEastTransitPoolStirrer2
=
new
ModualPool
.
pcMachine
(
"EastTransitPoolStirrer_2"
,
cEastTransitPoolStirrer2Base
);
private
static
ModualPool
.
pcMachine
cEastTransitPoolStirrer2
=
new
ModualPool
.
pcMachine
(
"EastTransitPoolStirrer_2"
,
cEastTransitPoolStirrer2Base
);
private
static
ModualPool
.
pcOperation
cEastTransitPoolStirrer3Base
=
new
ModualPool
.
pcOperation
private
static
ModualPool
.
pcOperation
cEastTransitPoolStirrer3Base
=
new
ModualPool
.
pcOperation
{
{
byModbusID
=
16
,
byModbusID
=
39
,
strOperationNumber
=
"d0
"
,
strOperationNumber
=
"d2
"
,
strChannelNumber
=
new
string
[]
{
"d0"
,
"d1
"
},
strChannelNumber
=
new
string
[]
{
"d2"
,
"d3
"
},
bOpenOperation
=
new
bool
[]
{
true
,
true
},
bOpenOperation
=
new
bool
[]
{
true
,
true
},
bCloseOperation
=
new
bool
[]
{
false
,
false
},
bCloseOperation
=
new
bool
[]
{
false
,
false
},
bHadRefControl
=
false
,
bHadRefControl
=
false
,
...
@@ -107,16 +107,28 @@ namespace ModbusDemo.application
...
@@ -107,16 +107,28 @@ namespace ModbusDemo.application
private
static
ModualPool
.
pcOperation
cEastTransitPoolStirrer4Base
=
new
ModualPool
.
pcOperation
private
static
ModualPool
.
pcOperation
cEastTransitPoolStirrer4Base
=
new
ModualPool
.
pcOperation
{
{
byModbusID
=
16
,
byModbusID
=
16
,
strOperationNumber
=
"d
0
"
,
strOperationNumber
=
"d
4
"
,
strChannelNumber
=
new
string
[]
{
"d
0"
,
"d1
"
},
strChannelNumber
=
new
string
[]
{
"d
4
"
},
bOpenOperation
=
new
bool
[]
{
true
,
true
},
bOpenOperation
=
new
bool
[]
{
true
},
bCloseOperation
=
new
bool
[]
{
false
,
false
},
bCloseOperation
=
new
bool
[]
{
false
},
bHadRefControl
=
false
,
bHadRefControl
=
false
,
byResModbusID
=
0xFF
,
byResModbusID
=
0xFF
,
strResChannelNumber
=
null
strResChannelNumber
=
null
};
};
private
static
ModualPool
.
pcMachine
cEastTransitPoolStirrer4
=
new
ModualPool
.
pcMachine
(
"EastTransitPoolStirrer_4"
,
cEastTransitPoolStirrer4Base
);
private
static
ModualPool
.
pcMachine
cEastTransitPoolStirrer4
=
new
ModualPool
.
pcMachine
(
"EastTransitPoolStirrer_4"
,
cEastTransitPoolStirrer4Base
);
private
static
ModualPool
.
pcButtonOperation
cEastTransitPoolButton1Base
=
new
ModualPool
.
pcButtonOperation
{
byModbusID
=
16
,
strOperationNumber
=
"d0"
,
strChannelNumber
=
new
string
[]{
"d0"
,
"d1"
},
bOpenOperation
=
new
bool
[]
{
true
,
true
},
bCloseOperation
=
new
bool
[]
{
false
,
false
}
};
private
static
ModualPool
.
pcButton
cEastTransitPoolButton1
=
new
ModualPool
.
pcButton
(
"EastTransitPoolButton1"
,
cEastTransitPoolButton1Base
);
public
static
List
<
ModualPool
.
pcMachine
>
EastTransitPoolList
=
new
List
<
ModualPool
.
pcMachine
>(
new
ModualPool
.
pcMachine
[]
{
cEastTransitPoolSouthWater
,
cEastTransitPoolNorthWater
,
cEastTransitPoolPumb1
,
cEastTransitPoolPumb2
,
cEastTransitPoolStirrer1
,
cEastTransitPoolStirrer2
,
cEastTransitPoolStirrer3
,
cEastTransitPoolStirrer4
});
public
static
class
cEastTransitPool
public
static
class
cEastTransitPool
{
{
public
static
double
vSetMaxLevel
;
public
static
double
vSetMaxLevel
;
...
@@ -131,7 +143,7 @@ namespace ModbusDemo.application
...
@@ -131,7 +143,7 @@ namespace ModbusDemo.application
public
static
ModualPool
.
pcMachine
cStirrer2
{
get
=>
cEastTransitPoolStirrer2
;
set
=>
cEastTransitPoolStirrer2
=
value
;
}
public
static
ModualPool
.
pcMachine
cStirrer2
{
get
=>
cEastTransitPoolStirrer2
;
set
=>
cEastTransitPoolStirrer2
=
value
;
}
public
static
ModualPool
.
pcMachine
cStirrer3
{
get
=>
cEastTransitPoolStirrer3
;
set
=>
cEastTransitPoolStirrer3
=
value
;
}
public
static
ModualPool
.
pcMachine
cStirrer3
{
get
=>
cEastTransitPoolStirrer3
;
set
=>
cEastTransitPoolStirrer3
=
value
;
}
public
static
ModualPool
.
pcMachine
cStirrer4
{
get
=>
cEastTransitPoolStirrer4
;
set
=>
cEastTransitPoolStirrer4
=
value
;
}
public
static
ModualPool
.
pcMachine
cStirrer4
{
get
=>
cEastTransitPoolStirrer4
;
set
=>
cEastTransitPoolStirrer4
=
value
;
}
public
static
ModualPool
.
pcButton
cButton1
{
get
=>
cEastTransitPoolButton1
;
set
=>
cEastTransitPoolButton1
=
value
;
}
private
static
void
vSet_Poll_Max_Level
(
double
dData
)
private
static
void
vSet_Poll_Max_Level
(
double
dData
)
{
{
vSetMaxLevel
=
dData
;
vSetMaxLevel
=
dData
;
...
...
ModbusDemo/application/ControlMap.cs
View file @
6e241f93
...
@@ -4,39 +4,113 @@ using System.Linq;
...
@@ -4,39 +4,113 @@ using System.Linq;
using
System.Text
;
using
System.Text
;
using
System.Threading.Tasks
;
using
System.Threading.Tasks
;
using
ModbusDemo.application
;
using
ModbusDemo.application
;
using
ModbusDemo.MessageFormat
;
namespace
ModbusDemo.application
namespace
ModbusDemo.application
{
{
public
class
ControlMap
public
class
ControlMap
{
{
public
delegate
bool
bDelege_Handle
(
bool
[]
bControlData
);
public
delegate
bool
bDelege_Handle
(
bool
[]
bControlData
);
public
static
bDelege_Handle
bDelege_Operation
;
public
static
bDelege_Handle
bDelege_Operation
;
public
static
byte
byMapIdleID
;
public
static
bool
bControl_Map
(
bool
bOpen
,
byte
byControlID
,
params
string
[]
strOperationChannelName
)
public
static
bool
[]
byMapIdleControlData
;
public
static
string
[]
strMapIdleChannelName
;
public
static
bool
bMap_Idle_Operation_Control
(
bool
[]
bControldata
)
{
bool
[]
bControlBit
=
new
bool
[
bControldata
.
Count
()];
bool
bStatus
;
for
(
int
i
=
0
;
i
<
bControldata
.
Count
();
i
++)
{
string
str
=
"d"
+
i
.
ToString
();
for
(
int
j
=
0
;
j
<
strMapIdleChannelName
.
Count
();
j
++)
{
if
(
str
==
strMapIdleChannelName
[
j
])
{
bControlBit
[
i
]
=
true
;
bControldata
[
i
]
=
byMapIdleControlData
[
i
];
}
}
}
bStatus
=
ModualControl
.
bOperation_Machine
(
true
,
byMapIdleID
,
bControldata
,
bControlBit
,
0
,
null
);
return
bStatus
;
}
public
static
bool
bControl_Map
(
bool
bOpen
,
byte
byControlID
,
bool
[]
bControlData
,
params
string
[]
strOperationChannelName
)
{
{
bool
bMapStatus
=
true
;
bool
bMapStatus
=
true
;
if
(
bOpen
==
true
)
if
(
bOpen
==
true
)
{
{
if
(
byControlID
==
16
&&
strOperationChannelName
[
0
]
==
"d0
"
)
if
(
byControlID
==
31
&&
strOperationChannelName
[
0
]
==
"d1
"
)
{
{
bDelege_Operation
=
AllPond
.
cEastTransitPool
.
cPumb1
.
bOpen_Machine
;
bDelege_Operation
=
AllPond
.
cEastTransitPool
.
cSouthWater
.
bOpen_Machine
;
}
else
if
(
byControlID
==
16
&&
strOperationChannelName
[
0
]
==
"d0"
)
{
bDelege_Operation
=
AllPond
.
cEastTransitPool
.
cNorthWater
.
bOpen_Machine
;
}
}
else
if
(
byControlID
==
16
&&
strOperationChannelName
[
0
]
==
"d2"
)
else
if
(
byControlID
==
16
&&
strOperationChannelName
[
0
]
==
"d2"
)
{
bDelege_Operation
=
AllPond
.
cEastTransitPool
.
cPumb1
.
bOpen_Machine
;
}
else
if
(
byControlID
==
35
&&
strOperationChannelName
[
0
]
==
"d0"
)
{
{
bDelege_Operation
=
AllPond
.
cEastTransitPool
.
cPumb2
.
bOpen_Machine
;
bDelege_Operation
=
AllPond
.
cEastTransitPool
.
cPumb2
.
bOpen_Machine
;
}
}
else
if
(
byControlID
==
35
&&
strOperationChannelName
[
0
]
==
"d2"
)
{
bDelege_Operation
=
AllPond
.
cEastTransitPool
.
cStirrer1
.
bOpen_Machine
;
}
else
if
(
byControlID
==
39
&&
strOperationChannelName
[
0
]
==
"d0"
)
{
bDelege_Operation
=
AllPond
.
cEastTransitPool
.
cStirrer2
.
bOpen_Machine
;
}
else
if
(
byControlID
==
39
&&
strOperationChannelName
[
0
]
==
"d2"
)
{
bDelege_Operation
=
AllPond
.
cEastTransitPool
.
cStirrer3
.
bOpen_Machine
;
}
else
{
byMapIdleID
=
byControlID
;
strMapIdleChannelName
=
strOperationChannelName
;
byMapIdleControlData
=
bControlData
;
bDelege_Operation
=
bMap_Idle_Operation_Control
;
}
}
}
else
else
{
{
if
(
byControlID
==
16
&&
strOperationChannelName
[
0
]
==
"d0
"
)
if
(
byControlID
==
31
&&
strOperationChannelName
[
0
]
==
"d1
"
)
{
{
bDelege_Operation
=
AllPond
.
cEastTransitPool
.
cPumb1
.
bClose_Machine
;
bDelege_Operation
=
AllPond
.
cEastTransitPool
.
cSouthWater
.
bClose_Machine
;
}
else
if
(
byControlID
==
16
&&
strOperationChannelName
[
0
]
==
"d0"
)
{
bDelege_Operation
=
AllPond
.
cEastTransitPool
.
cNorthWater
.
bClose_Machine
;
}
}
else
if
(
byControlID
==
16
&&
strOperationChannelName
[
0
]
==
"d2"
)
else
if
(
byControlID
==
16
&&
strOperationChannelName
[
0
]
==
"d2"
)
{
bDelege_Operation
=
AllPond
.
cEastTransitPool
.
cPumb1
.
bClose_Machine
;
}
else
if
(
byControlID
==
35
&&
strOperationChannelName
[
0
]
==
"d0"
)
{
{
bDelege_Operation
=
AllPond
.
cEastTransitPool
.
cPumb2
.
bClose_Machine
;
bDelege_Operation
=
AllPond
.
cEastTransitPool
.
cPumb2
.
bClose_Machine
;
}
}
else
if
(
byControlID
==
35
&&
strOperationChannelName
[
0
]
==
"d2"
)
{
bDelege_Operation
=
AllPond
.
cEastTransitPool
.
cStirrer1
.
bClose_Machine
;
}
else
if
(
byControlID
==
39
&&
strOperationChannelName
[
0
]
==
"d0"
)
{
bDelege_Operation
=
AllPond
.
cEastTransitPool
.
cStirrer2
.
bClose_Machine
;
}
else
if
(
byControlID
==
39
&&
strOperationChannelName
[
0
]
==
"d2"
)
{
bDelege_Operation
=
AllPond
.
cEastTransitPool
.
cStirrer3
.
bClose_Machine
;
}
else
{
byMapIdleID
=
byControlID
;
strMapIdleChannelName
=
strOperationChannelName
;
byMapIdleControlData
=
bControlData
;
bDelege_Operation
=
bMap_Idle_Operation_Control
;
}
}
}
return
bMapStatus
;
return
bMapStatus
;
}
}
...
...
ModbusDemo/application/ModualPool.cs
View file @
6e241f93
...
@@ -92,25 +92,13 @@ namespace ModbusDemo.application
...
@@ -92,25 +92,13 @@ namespace ModbusDemo.application
public
bool
bHadRefControl
;
public
bool
bHadRefControl
;
public
byte
byResModbusID
;
public
byte
byResModbusID
;
public
string
strResChannelNumber
;
public
string
strResChannelNumber
;
}
//public pcOperation(byte byControlID, string[] strChannelNumber,string strOperationNumber,bool bHadRefControl,byte byResID,string strResChannelName,bool[] bOpenData,bool[] bCloseData)
public
class
pcMachine
:
pcOperation
//{
// this.byModbusID = byControlID;
// this.strChannelNumber = strChannelNumber;
// this.strOperationNumber = strOperationNumber;
// this.bHadRefControl = bHadRefControl;
// this.byResModbusID = byResID;
// this.strResChannelNumber = strResChannelName;
// this.bOpenOperation = bOpenData;
// this.bCloseOperation = bCloseData;
//}
}
public
class
pcMachine
:
pcOperation
{
{
public
string
strMachinebName
;
public
string
strMachinebName
;
public
double
dChannelCurrent
{
get
=>
vGet_ResCurrent
();}
public
double
dChannelCurrent
{
get
=>
vGet_ResCurrent
();}
public
bool
bHadOpenPumb
;
public
bool
bHadOpenPumb
;
public
bool
[]
bCurrentRelay
;
public
bool
[]
bCurrentRelay
{
get
=>
bGet_Current_Relay
();}
public
pcMachine
(
string
strMachineName
,
pcOperation
pcOperation
)
// base(pcOperation.byModbusID,pcOperation.strChannelNumber,pcOperation.strOperationNumber,pcOperation.bHadRefControl,pcOperation.byResModbusID,pcOperation.strResChannelNumber,pcOperation.bOpenOperation,pcOperation.bCloseOperation)
public
pcMachine
(
string
strMachineName
,
pcOperation
pcOperation
)
// base(pcOperation.byModbusID,pcOperation.strChannelNumber,pcOperation.strOperationNumber,pcOperation.bHadRefControl,pcOperation.byResModbusID,pcOperation.strResChannelNumber,pcOperation.bOpenOperation,pcOperation.bCloseOperation)
{
{
this
.
strMachinebName
=
strMachineName
;
this
.
strMachinebName
=
strMachineName
;
...
@@ -123,7 +111,6 @@ namespace ModbusDemo.application
...
@@ -123,7 +111,6 @@ namespace ModbusDemo.application
this
.
bOpenOperation
=
pcOperation
.
bOpenOperation
;
this
.
bOpenOperation
=
pcOperation
.
bOpenOperation
;
this
.
bCloseOperation
=
pcOperation
.
bCloseOperation
;
this
.
bCloseOperation
=
pcOperation
.
bCloseOperation
;
}
}
public
bool
bOpen_Machine
(
bool
[]
bControldata
)
public
bool
bOpen_Machine
(
bool
[]
bControldata
)
{
{
bool
[]
bControlBit
=
new
bool
[
bControldata
.
Count
()];
bool
[]
bControlBit
=
new
bool
[
bControldata
.
Count
()];
...
@@ -146,7 +133,6 @@ namespace ModbusDemo.application
...
@@ -146,7 +133,6 @@ namespace ModbusDemo.application
}
}
return
bStatus
;
return
bStatus
;
}
}
public
bool
bClose_Machine
(
bool
[]
bControldata
)
public
bool
bClose_Machine
(
bool
[]
bControldata
)
{
{
bool
[]
bControlBit
=
new
bool
[
bControldata
.
Count
()];
bool
[]
bControlBit
=
new
bool
[
bControldata
.
Count
()];
...
@@ -169,16 +155,96 @@ namespace ModbusDemo.application
...
@@ -169,16 +155,96 @@ namespace ModbusDemo.application
}
}
return
bStatus
;
return
bStatus
;
}
}
private
double
vGet_ResCurrent
()
private
double
vGet_ResCurrent
()
{
{
double
[]
dConvertData
;
double
[]
dConvertData
;
if
(
ModualPoll
.
bGet_channel_Value
<
double
>(
byResModbusID
,
out
dConvertData
,
strResChannelNumber
)
==
true
)
if
(
bHadRefControl
==
true
&&
ModualPoll
.
bGet_channel_Value
<
double
>(
byResModbusID
,
out
dConvertData
,
strResChannelNumber
)
==
true
)
{
{
return
dConvertData
[
0
];
return
dConvertData
[
0
];
}
}
return
0
;
return
0
;
}
}
private
bool
[]
bGet_Current_Relay
()
{
bool
[]
bRelaydata
;
if
(
ModualPoll
.
bGet_channel_Value
<
bool
>(
byModbusID
,
out
bRelaydata
,
strChannelNumber
)
==
true
)
{
return
bRelaydata
;
}
else
{
return
bRelaydata
;
}
}
}
public
class
pcButtonOperation
{
public
byte
byModbusID
;
public
string
[]
strChannelNumber
;
public
string
strOperationNumber
;
public
bool
[]
bOpenOperation
;
public
bool
[]
bCloseOperation
;
}
public
class
pcButton
:
pcButtonOperation
{
public
string
strButtonName
;
public
bool
[]
bCurrentRelay
{
get
=>
bGet_Current_Relay
();}
public
pcButton
(
string
strButtonName
,
pcButtonOperation
cButtonOperation
)
{
this
.
strButtonName
=
strButtonName
;
this
.
byModbusID
=
cButtonOperation
.
byModbusID
;
this
.
strOperationNumber
=
cButtonOperation
.
strOperationNumber
;
this
.
strChannelNumber
=
cButtonOperation
.
strChannelNumber
;
this
.
bOpenOperation
=
cButtonOperation
.
bOpenOperation
;
this
.
bCloseOperation
=
cButtonOperation
.
bCloseOperation
;
}
public
bool
bOpreation_Button
(
bool
[]
bControldata
)
{
bool
bStatus
;
bool
[]
bControlBit
=
new
bool
[
bControldata
.
Count
()];
for
(
int
i
=
0
;
i
<
bControldata
.
Count
();
i
++)
{
string
str
=
"d"
+
i
.
ToString
();
for
(
int
j
=
0
;
j
<
strChannelNumber
.
Count
();
j
++)
{
if
(
str
==
strChannelNumber
[
j
])
{
bControlBit
[
i
]
=
true
;
bControldata
[
i
]
=
bOpenOperation
[
j
];
}
}
}
if
((
bStatus
=
ModualControl
.
bOperation_Machine
(
true
,
byModbusID
,
bControldata
,
bControlBit
,
0
,
null
))
==
true
)
{
for
(
int
i
=
0
;
i
<
bControldata
.
Count
();
i
++)
{
string
str
=
"d"
+
i
.
ToString
();
for
(
int
j
=
0
;
j
<
strChannelNumber
.
Count
();
j
++)
{
if
(
str
==
strChannelNumber
[
j
])
{
bControlBit
[
i
]
=
true
;
bControldata
[
i
]
=
bCloseOperation
[
j
];
}
}
}
bStatus
=
ModualControl
.
bOperation_Machine
(
true
,
byModbusID
,
bControldata
,
bControlBit
,
0
,
null
);
}
return
bStatus
;
}
private
bool
[]
bGet_Current_Relay
()
{
bool
[]
bRelaydata
;
if
(
ModualPoll
.
bGet_channel_Value
<
bool
>(
byModbusID
,
out
bRelaydata
,
strChannelNumber
)
==
true
)
{
return
bRelaydata
;
}
else
{
return
bRelaydata
;
}
}
}
}
}
}
}
}
ModbusDemo/application/PoolModbusSet.cs
deleted
100644 → 0
View file @
f07825d9
This diff is collapsed.
Click to expand it.
ModbusDemo/application/UsThread.cs
deleted
100644 → 0
View file @
f07825d9
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
using
System.Threading
;
namespace
ModbusDemo.application
{
}
ModbusDemo/windows/Form1.cs
View file @
6e241f93
...
@@ -26,7 +26,7 @@ namespace ModbusDemo
...
@@ -26,7 +26,7 @@ namespace ModbusDemo
{
{
public
partial
class
Form1
:
Form
public
partial
class
Form1
:
Form
{
{
const
bool
LOCALDEBUG
=
tru
e
;
const
bool
LOCALDEBUG
=
fals
e
;
private
bool
bStart
=
false
;
private
bool
bStart
=
false
;
AutoResetEvent
exitEvent
;
AutoResetEvent
exitEvent
;
private
int
waitTime
;
private
int
waitTime
;
...
@@ -1069,48 +1069,6 @@ namespace ModbusDemo
...
@@ -1069,48 +1069,6 @@ namespace ModbusDemo
private
void
button2_Click
(
object
sender
,
EventArgs
e
)
private
void
button2_Click
(
object
sender
,
EventArgs
e
)
{
{
<<<<<<<
HEAD
=======
<<<<<<<
HEAD
=======
//AutoControl.Control usEcontrol = new AutoControl.Control();
//AutoControl.Control usWcontrol = new AutoControl.Control();
//if (ModualControl.cPoolLevelConfig.Count!=0)
//{
// for (int i = 0; i < ModualControl.cPoolLevelConfig.Count; i++)
// {
// if (ModualControl.cPoolLevelConfig[i].byModbusID == 6)
// {
// usWcontrol.maxLevel = ModualControl.cPoolLevelConfig[i].dUpLevel;
// usWcontrol.minLevel = ModualControl.cPoolLevelConfig[i].dDownLevel;
// usWcontrol.Name = "西·中转池";
// usWcontrol.Enablation = true;
// AutoControl.CriticalValueMonitoring(true, ModualControl.cPoolLevelConfig[1].dUpLevel,
// ModualControl.cPoolLevelConfig[0].dDownLevel, ModualPoll.cx18x.sX18xDataStruct[1].dNowConvertData[1],
// "西·中转池",
// out usWcontrol
// );
// }
// if (ModualControl.cPoolLevelConfig[i].byModbusID == 3)
// {
// usEcontrol.maxLevel = ModualControl.cPoolLevelConfig[i].dUpLevel;
// usEcontrol.minLevel = ModualControl.cPoolLevelConfig[i].dDownLevel;
// usEcontrol.Name = "东·中转池";
// usEcontrol.Enablation = true;
// AutoControl.CriticalValueMonitoring(true, ModualControl.cPoolLevelConfig[0].dUpLevel,
// ModualControl.cPoolLevelConfig[0].dDownLevel, ModualPoll.cx18x.sX18xDataStruct[0].dNowConvertData[0],
// "东·中转池",
// out usEcontrol
// );
// }
// }
//}
>>>>>>>
83d8d9d1
b2182210455375f355bb9f6860d45dc2
>>>>>>>
5635
bdf708c90bb2146f99466d1145dda5dabb37
}
}
...
@@ -1174,9 +1132,9 @@ namespace ModbusDemo
...
@@ -1174,9 +1132,9 @@ namespace ModbusDemo
ModbusComm
.
Modbus
.
Transport
.
ReadTimeout
=
1000
;
ModbusComm
.
Modbus
.
Transport
.
ReadTimeout
=
1000
;
ModbusComm
.
Modbus
.
Transport
.
WriteTimeout
=
1000
;
ModbusComm
.
Modbus
.
Transport
.
WriteTimeout
=
1000
;
ModbusComm
.
Modbus
.
Transport
.
WaitToRetryMilliseconds
=
0
;
ModbusComm
.
Modbus
.
Transport
.
WaitToRetryMilliseconds
=
0
;
t_AutoControl
=
new
Thread
(
T_AutoControl
);
//
t_AutoControl = new Thread(T_AutoControl);
t_AutoControl
.
IsBackground
=
true
;
//
t_AutoControl.IsBackground = true;
t_AutoControl
.
Start
();
//
t_AutoControl.Start();
modbus_Timer
.
Enabled
=
true
;
modbus_Timer
.
Enabled
=
true
;
btOpenCOM
.
Enabled
=
false
;
btOpenCOM
.
Enabled
=
false
;
btCloseCOM
.
Enabled
=
true
;
btCloseCOM
.
Enabled
=
true
;
...
...
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