修改波特率算法

This commit is contained in:
高国正 2023-02-24 16:10:23 +08:00
parent 30ef1591d0
commit 591e0e1b8f
18 changed files with 41 additions and 4290 deletions

BIN
Dianci/.vs/Dianci/v16/.suo Normal file

Binary file not shown.

View File

@ -43,6 +43,9 @@ internal class MagnetServer
/// </summary>
public static int loopTime = 10;
//public static float TRAS = 1000 / 2400 * 12.5f;//3.5字符周期周期时间单位ms
public static float TRAS = 3.5f * 9 / 2.4f;//3.5字符周期周期时间单位ms单条发送周期时间
/// <summary>
/// 添加数据寄存器信息
/// </summary>
@ -130,6 +133,7 @@ internal class MagnetServer
{
foreach (var item in RegisterType.Keys)
{
Thread.Sleep((int)Math.Ceiling(TRAS));
ushort start = (ushort)item;
ushort length = ushort.Parse(RegisterType[item][3].ToString());
bytes = ReadKsepRsgistecs(devAdd, code, start, length);
@ -149,12 +153,12 @@ internal class MagnetServer
//TCP
try
{
//var ip = "172.17.0.9";
//var port = 12303;
var ip = "172.16.1.49";
var ip = "172.17.0.9";
var port = 12303;
//var ip = "172.16.1.49";
//var port = 12303;
//调用socket(函数创建一个用于通信的套接字。
serverSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
@ -445,16 +449,16 @@ internal class MagnetServer
}
else if (name == "仪表通讯速度")
{
float TRAS;//3.5字符周期周期时间单位ms
if (number == 0) { Console.WriteLine(name + ":300"); TRAS = 1000 / 300 * 12.5f; }
else if (number == 1) { Console.WriteLine(name + ":2400"); TRAS = 1000 / 2400 * 12.5f; }
else if (number == 2) { Console.WriteLine(name + ":14400"); TRAS = 1000 / 14400 * 12.5f; }
else if (number == 3) { Console.WriteLine(name + ":600"); TRAS = 1000 / 600 * 12.5f; }
else if (number == 4) { Console.WriteLine(name + ":4800"); TRAS = 1000 / 4800 * 12.5f; }
else if (number == 5) { Console.WriteLine(name + ":19200"); TRAS = 1000 / 19200 * 12.5f; }
else if (number == 6) { Console.WriteLine(name + ":1200"); TRAS = 1000 / 1200 * 12.5f; }
else if (number == 7) { Console.WriteLine(name + ":9600"); TRAS = 1000 / 9600 * 12.5f; }
else if (number == 8) { Console.WriteLine(name + ":38400"); TRAS = 1000 / 38400 * 12.5f; }
//float TRAS;//3.5字符周期周期时间单位ms
if (number == 0) { Console.WriteLine(name + ":300"); /*TRAS = 1000 / 300 * 12.5f;*/ TRAS = 3.5f * 9 / 0.3f; }
else if (number == 1) { Console.WriteLine(name + ":2400"); /*TRAS = 1000 / 2400 * 12.5f;*/ TRAS = 3.5f * 9 / 2.4f; }
else if (number == 2) { Console.WriteLine(name + ":14400"); /*TRAS = 1000 / 14400 * 12.5f; */TRAS = 3.5f * 9 / 14.4f; }
else if (number == 3) { Console.WriteLine(name + ":600"); /*TRAS = 1000 / 600 * 12.5f; */TRAS = 3.5f * 9 / 0.6f; }
else if (number == 4) { Console.WriteLine(name + ":4800");/* TRAS = 1000 / 4800 * 12.5f;*/ TRAS = 3.5f * 9 / 4.8f; }
else if (number == 5) { Console.WriteLine(name + ":19200"); /*TRAS = 1000 / 19200 * 12.5f;*/ TRAS = 3.5f * 9 / 19.2f; }
else if (number == 6) { Console.WriteLine(name + ":1200"); /*TRAS = 1000 / 1200 * 12.5f; */TRAS = 3.5f * 9 / 1.2f; }
else if (number == 7) { Console.WriteLine(name + ":9600"); /*TRAS = 1000 / 9600 * 12.5f;*/ TRAS = 3.5f * 9 / 9.6f; }
else if (number == 8) { Console.WriteLine(name + ":38400"); /*TRAS = 1000 / 38400 * 12.5f;*/ TRAS = 3.5f * 9 / 38.4f; }
}
else if (name == "修改口径")

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1 +1 @@
898be911263aa5e48f96ba6f764bf3ee4a35a632
ee53c599275c758c8e6a8f9879a68f09981ec54e

View File

@ -20,3 +20,13 @@ D:\GaoGuoZheng_U3D\C#\nenglaingbiao\Dianci\obj\Debug\Dianci.csproj.CoreCompileIn
D:\GaoGuoZheng_U3D\C#\nenglaingbiao\Dianci\obj\Debug\Dianci.csproj.CopyComplete
D:\GaoGuoZheng_U3D\C#\nenglaingbiao\Dianci\obj\Debug\ceshi.exe
D:\GaoGuoZheng_U3D\C#\nenglaingbiao\Dianci\obj\Debug\ceshi.pdb
D:\XM\C#\nenglaingbiao\Dianci\bin\Debug\ceshi.exe.config
D:\XM\C#\nenglaingbiao\Dianci\bin\Debug\ceshi.exe
D:\XM\C#\nenglaingbiao\Dianci\bin\Debug\ceshi.pdb
D:\XM\C#\nenglaingbiao\Dianci\bin\Debug\log4net.dll
D:\XM\C#\nenglaingbiao\Dianci\bin\Debug\log4net.xml
D:\XM\C#\nenglaingbiao\Dianci\obj\Debug\Dianci.csproj.AssemblyReference.cache
D:\XM\C#\nenglaingbiao\Dianci\obj\Debug\Dianci.csproj.CoreCompileInputs.cache
D:\XM\C#\nenglaingbiao\Dianci\obj\Debug\Dianci.csproj.CopyComplete
D:\XM\C#\nenglaingbiao\Dianci\obj\Debug\ceshi.exe
D:\XM\C#\nenglaingbiao\Dianci\obj\Debug\ceshi.pdb

Binary file not shown.

Binary file not shown.

View File

@ -1 +1 @@
73dddfdf5ddec9ab02df30c1163cfbf98d3b50f4
d22c0e5a0faddf594ad7259f4245606940e30fd6

View File

@ -20,3 +20,13 @@ D:\GaoGuoZheng_U3D\C#\nenglaingbiao\Dianci\obj\Release\Dianci.csproj.CoreCompile
D:\GaoGuoZheng_U3D\C#\nenglaingbiao\Dianci\obj\Release\Dianci.csproj.CopyComplete
D:\GaoGuoZheng_U3D\C#\nenglaingbiao\Dianci\obj\Release\ceshi.exe
D:\GaoGuoZheng_U3D\C#\nenglaingbiao\Dianci\obj\Release\ceshi.pdb
D:\XM\C#\nenglaingbiao\Dianci\bin\Release\ceshi.exe.config
D:\XM\C#\nenglaingbiao\Dianci\bin\Release\ceshi.exe
D:\XM\C#\nenglaingbiao\Dianci\bin\Release\ceshi.pdb
D:\XM\C#\nenglaingbiao\Dianci\bin\Release\log4net.dll
D:\XM\C#\nenglaingbiao\Dianci\bin\Release\log4net.xml
D:\XM\C#\nenglaingbiao\Dianci\obj\Release\Dianci.csproj.AssemblyReference.cache
D:\XM\C#\nenglaingbiao\Dianci\obj\Release\Dianci.csproj.CoreCompileInputs.cache
D:\XM\C#\nenglaingbiao\Dianci\obj\Release\Dianci.csproj.CopyComplete
D:\XM\C#\nenglaingbiao\Dianci\obj\Release\ceshi.exe
D:\XM\C#\nenglaingbiao\Dianci\obj\Release\ceshi.pdb

Binary file not shown.

Binary file not shown.