2014-08-28 update 1
This commit is contained in:
@@ -10,7 +10,7 @@ namespace NA200H.UI.ConsoleApp
|
||||
{
|
||||
class Program
|
||||
{
|
||||
static void Main(string[] args)
|
||||
private static void Main(string[] args)
|
||||
{
|
||||
/*
|
||||
string ip = "192.168.4.247";
|
||||
@@ -36,7 +36,7 @@ namespace NA200H.UI.ConsoleApp
|
||||
Console.Read();
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/*string ip = "192.168.3.246";
|
||||
try
|
||||
{
|
||||
@@ -105,13 +105,19 @@ namespace NA200H.UI.ConsoleApp
|
||||
Console.Read();
|
||||
Console.Read();*/
|
||||
|
||||
ReadHoldRegisterModbusProtocal.ReadHoldRegisterInputStruct readHoldRegisterInputStruct = new ReadHoldRegisterModbusProtocal.ReadHoldRegisterInputStruct(2, "0", 4);
|
||||
ReadHoldRegisterModbusProtocal.ReadHoldRegisterOutputStruct readHoldRegisterOutputStruct = (ReadHoldRegisterModbusProtocal.ReadHoldRegisterOutputStruct)wrapper.SendReceive(wrapper["ReadHoldRegisterModbusProtocal"], readHoldRegisterInputStruct);
|
||||
for (int i = 0; i < readHoldRegisterOutputStruct.HoldRegisterStatus.Length; i++)
|
||||
ushort[] holdRegArr = ModbusUtility.GetInstance().ReadHoldRegister(0x02, "0", 4);
|
||||
foreach (var holdReg in holdRegArr)
|
||||
{
|
||||
Console.WriteLine(readHoldRegisterOutputStruct.HoldRegisterStatus[i]);
|
||||
Console.WriteLine(holdReg);
|
||||
}
|
||||
Console.Read();
|
||||
Console.Read();
|
||||
|
||||
Console.WriteLine(ModbusUtility.GetInstance()
|
||||
.WriteMultiRegister(0x02, "0", new object[] {(ushort) 8, (ushort) 9, (ushort) 10}));
|
||||
Console.Read();
|
||||
Console.Read();
|
||||
|
||||
/*
|
||||
//调用方法二:自动构造
|
||||
//第一步:先生成一个输入结构体,然后向这个结构体中填写数据
|
||||
|
||||
Reference in New Issue
Block a user