Commit 275d3c03 刘韬

1

1 个父辈 0bf0be36
正在显示 37 个修改的文件 包含 301 行增加33 行删除
此文件类型无法预览
...@@ -15,5 +15,6 @@ ...@@ -15,5 +15,6 @@
bool ReadData(out string value, short length); bool ReadData(out string value, short length);
void TriggerMode(bool auto); void TriggerMode(bool auto);
bool WriteData(string id); bool WriteData(string id);
bool WriteData(byte[] data);
} }
} }
\ No newline at end of file \ No newline at end of file
...@@ -175,6 +175,12 @@ namespace Asa.RFID ...@@ -175,6 +175,12 @@ namespace Asa.RFID
{ {
if (_fullCmd[7] == 0x03) if (_fullCmd[7] == 0x03)
{ {
if (length > 4)
{
var b = _fullCmd.GetRange(10, length).ToArray();
value = Encoding.ASCII.GetString(b);
}
else
value = (char)_fullCmd[10] + _fullCmd[11].ToString(); value = (char)_fullCmd[10] + _fullCmd[11].ToString();
rtn = true; rtn = true;
} }
...@@ -589,7 +595,72 @@ namespace Asa.RFID ...@@ -589,7 +595,72 @@ namespace Asa.RFID
//Common.log.Error(string.Format("Write[{0}] ERROR", IP), ex); //Common.log.Error(string.Format("Write[{0}] ERROR", IP), ex);
} }
} }
public bool WriteData(byte[] data)
{
_dataMode = false;
bool rtn = false;
Write(data);
if (Wait())
{
var a=("Write[" + IP + "] " + HexBuff(_fullCmd.ToArray()));
if (_fullCmd[7] == 0x10)
rtn = true;
//else
// Common.log.Info("0x10功能码不匹配");
}
return rtn;
}
private void Write(byte[] value)
{
if (!IsConn) return;
int registercount = (int)Math.Ceiling(value.Length / 2d);
//int registercount = (int)value.Length;
//int valuelen = registercount * 2;
byte[] temp;
byte[] buffer = new byte[13];
GetMark();
temp = BitConverter.GetBytes(_mark); //事务处理标识
buffer[0] = temp[1]; //高位
buffer[1] = temp[0]; //低位
buffer[2] = 0;
buffer[3] = 0; //协议标识
buffer[4] = 0;
buffer[5] = 15; //后面字节数
buffer[6] = 0xFF; //主设备
buffer[7] = 0x10; //功能码
buffer[8] = 0x00;
buffer[9] = 0x20; //地址
buffer[10] = 0;
buffer[11] = (byte)registercount; //寄存器个数
buffer[12] = (byte)(registercount*2); //数据长度
var ab = buffer.ToList();
ab.AddRange(value);
if (value.Length < registercount * 2)
ab.Add(0x00);
buffer = ab.ToArray();
buffer[5] = (byte)(7 + registercount * 2);
try
{
_total = false;
//Common.log.Debug("Write[" + IP + "] " + HexBuff(buffer));
if (_client != null)
_client.Send(buffer);
}
catch (Exception ex)
{
IsConn = false;
//Common.log.Error(string.Format("Write[{0}] ERROR", IP), ex);
}
}
private void GetMark() private void GetMark()
{ {
if (_mark == short.MaxValue) if (_mark == short.MaxValue)
......
...@@ -9,6 +9,7 @@ using System.Threading.Tasks; ...@@ -9,6 +9,7 @@ using System.Threading.Tasks;
public class PuYueRFID_C2S public class PuYueRFID_C2S
{ {
byte station = 1; byte station = 1;
bool Automode;
public string IP; public string IP;
TcpClient tcpClient = new TcpClient(); TcpClient tcpClient = new TcpClient();
Thread iomonitorThread; Thread iomonitorThread;
...@@ -19,10 +20,10 @@ public class PuYueRFID_C2S ...@@ -19,10 +20,10 @@ public class PuYueRFID_C2S
/// 连接状态变化, 手动连接不触发 /// 连接状态变化, 手动连接不触发
/// </summary> /// </summary>
public event EventHandler<bool> ConnectionState_Event; public event EventHandler<bool> ConnectionState_Event;
public PuYueRFID_C2S(string ip) public PuYueRFID_C2S(string ip, bool automode = false)
{ {
this.IP = ip; this.IP = ip;
Automode = automode;
//DOdata[0] = 0x00; //DOdata[0] = 0x00;
//DOdata[1] = 0x00; //DOdata[1] = 0x00;
//if (autoread) //if (autoread)
...@@ -57,9 +58,12 @@ public class PuYueRFID_C2S ...@@ -57,9 +58,12 @@ public class PuYueRFID_C2S
{ {
Init(); Init();
systemrun = true; systemrun = true;
if (Automode)
{
iomonitorrun = true; iomonitorrun = true;
iomonitorThread = new Thread(new ThreadStart(iomonitor)); iomonitorThread = new Thread(new ThreadStart(iomonitor));
iomonitorThread.Start(); iomonitorThread.Start();
}
ConnectionState_Event?.Invoke(this, true); ConnectionState_Event?.Invoke(this, true);
return true; return true;
} }
...@@ -81,11 +85,11 @@ public class PuYueRFID_C2S ...@@ -81,11 +85,11 @@ public class PuYueRFID_C2S
void Init() void Init()
{ {
//0设备地址,1波特率,2蜂鸣器状态,4天线盘存次数,6工作模式,7操作标签模式,8盘存标签超时时间,9自动触发间隔时间,10配置自动输出格式,11ASCII数据帧帧头,12标签记录保存时间
short[] value = new short[] { 1, 2, 1, 0, 1, 0, 1, 2, 20, 20, 0x81, 0x1234, 20 };
//设备地址1,波特率,禁止AFI,盘点超时时间(100*5ms),命令触发,操作模式,寄存器地址,寄存器数量,触发时间(10*5ms),输出格式,数据帧枕头,记录保持时间(9*5ms) //设备地址1,波特率,禁止AFI,盘点超时时间(100*5ms),命令触发,操作模式,寄存器地址,寄存器数量,触发时间(10*5ms),输出格式,数据帧枕头,记录保持时间(9*5ms)
short[] address = new short[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12}; short[] address = new short[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 };
//short[] value = new short[] { 1, 2, 0, 100, 1, 1, 0x20, 4, 20, 1, 0x1234, 19 }; short[] value = new short[] { 1, 2, 0, 100, 1, 1, 0x20, 4, 20, 1, 0x1234, 19 };
for (int i = 0; i < address.Length; i++) for (int i = 0; i < address.Length; i++)
{ {
WriteDO(address[i], value[i]); WriteDO(address[i], value[i]);
...@@ -335,6 +339,7 @@ public class PuYueRFID_C2S ...@@ -335,6 +339,7 @@ public class PuYueRFID_C2S
} }
catch catch
{ {
Open();
return -1; return -1;
} }
} }
......
...@@ -32,6 +32,10 @@ ...@@ -32,6 +32,10 @@
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=692fbea5521e1304, processorArchitecture=AMD64">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\log4net.2.0.12\lib\net45\log4net.dll</HintPath>
</Reference>
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Core" /> <Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" /> <Reference Include="System.Xml.Linq" />
...@@ -44,6 +48,7 @@ ...@@ -44,6 +48,7 @@
<ItemGroup> <ItemGroup>
<Compile Include="IPuYue.cs" /> <Compile Include="IPuYue.cs" />
<Compile Include="ModuleEnum.cs" /> <Compile Include="ModuleEnum.cs" />
<Compile Include="PuYueRFID_FR540SP_C2S.cs" />
<Compile Include="PuYueRFID_C2S.cs" /> <Compile Include="PuYueRFID_C2S.cs" />
<Compile Include="PuYue_FR540SP.cs" /> <Compile Include="PuYue_FR540SP.cs" />
<Compile Include="PuYue.cs" /> <Compile Include="PuYue.cs" />
......
...@@ -229,6 +229,71 @@ ...@@ -229,6 +229,71 @@
<param name="address"></param> <param name="address"></param>
<param name="value"></param> <param name="value"></param>
</member> </member>
<member name="E:PuYueRFID_FR540SP_C2S.ConnectionState_Event">
<summary>
连接状态变化, 手动连接不触发
</summary>
</member>
<member name="M:PuYueRFID_FR540SP_C2S.Finalize">
<summary>
销毁
</summary>
</member>
<member name="M:PuYueRFID_FR540SP_C2S.Open">
<summary>
打开IO
</summary>
<returns></returns>
</member>
<member name="P:PuYueRFID_FR540SP_C2S.AntennaPower">
<summary>
设置天线功率dBm
</summary>
</member>
<member name="M:PuYueRFID_FR540SP_C2S.Close">
<summary>
关闭IO
</summary>
</member>
<member name="P:PuYueRFID_FR540SP_C2S.IsConn">
<summary>
连接状态
</summary>
</member>
<member name="M:PuYueRFID_FR540SP_C2S.iomonitor">
<summary>
循环读全部IO
</summary>
</member>
<member name="M:PuYueRFID_FR540SP_C2S.WriteDO(System.Int16,System.Int16)">
<summary>
写寄存器
</summary>
<param name="address"></param>
<param name="value"></param>
<returns></returns>
</member>
<member name="M:PuYueRFID_FR540SP_C2S.ReadDO">
<summary>
读全部IO
</summary>
</member>
<member name="M:PuYueRFID_FR540SP_C2S.TryRead(System.String@,System.Double@)">
<summary>
读取rfid
</summary>
<param name="id">读取到的id</param>
<param name="ms">最后读到的时间ms</param>
<returns>读取成功状态-1读取失败,0没有读到,1读取成功</returns>
</member>
<member name="M:PuYueRFID_FR540SP_C2S.WriteByte(System.Int16,System.Byte[])">
<summary>
写入字节最大 64字
</summary>
<param name="address"></param>
<param name="data"></param>
<returns></returns>
</member>
<member name="E:PuYueRFID_C2S.ConnectionState_Event"> <member name="E:PuYueRFID_C2S.ConnectionState_Event">
<summary> <summary>
连接状态变化, 手动连接不触发 连接状态变化, 手动连接不触发
......
此文件类型无法预览
此文件的差异太大,无法显示。
5644c7488f7eac6c22e01d03f244c400a4a0f511 edd42431a59bd4fbe4c83f05fb8307780e858553
...@@ -12,3 +12,6 @@ D:\rick\vs\RFID\RFID_PuYue\obj\Debug\RFID_PuYue.csproj.AssemblyReference.cache ...@@ -12,3 +12,6 @@ D:\rick\vs\RFID\RFID_PuYue\obj\Debug\RFID_PuYue.csproj.AssemblyReference.cache
D:\rick\vs\RFID\RFID_PuYue\obj\Debug\RFID_PuYue.csproj.CoreCompileInputs.cache D:\rick\vs\RFID\RFID_PuYue\obj\Debug\RFID_PuYue.csproj.CoreCompileInputs.cache
D:\rick\vs\RFID\RFID_PuYue\obj\Debug\Asa.RFID.PuYue.dll D:\rick\vs\RFID\RFID_PuYue\obj\Debug\Asa.RFID.PuYue.dll
D:\rick\vs\RFID\RFID_PuYue\obj\Debug\Asa.RFID.PuYue.pdb D:\rick\vs\RFID\RFID_PuYue\obj\Debug\Asa.RFID.PuYue.pdb
D:\rick\vs\RFID\RFID_PuYue\bin\Debug\log4net.dll
D:\rick\vs\RFID\RFID_PuYue\bin\Debug\log4net.xml
D:\rick\vs\RFID\RFID_PuYue\obj\Debug\RFID_PuYue.csproj.CopyComplete
...@@ -35,7 +35,6 @@ namespace RFID_PuYue_Debug ...@@ -35,7 +35,6 @@ namespace RFID_PuYue_Debug
this.BtnInit = new System.Windows.Forms.Button(); this.BtnInit = new System.Windows.Forms.Button();
this.BtnAutoMode = new System.Windows.Forms.Button(); this.BtnAutoMode = new System.Windows.Forms.Button();
this.BtnManual = new System.Windows.Forms.Button(); this.BtnManual = new System.Windows.Forms.Button();
this.CboLetter = new System.Windows.Forms.ComboBox();
this.NudNumber = new System.Windows.Forms.NumericUpDown(); this.NudNumber = new System.Windows.Forms.NumericUpDown();
this.BtnWrite = new System.Windows.Forms.Button(); this.BtnWrite = new System.Windows.Forms.Button();
this.LblMode = new System.Windows.Forms.Label(); this.LblMode = new System.Windows.Forms.Label();
...@@ -43,6 +42,7 @@ namespace RFID_PuYue_Debug ...@@ -43,6 +42,7 @@ namespace RFID_PuYue_Debug
this.LblRfid = new System.Windows.Forms.Label(); this.LblRfid = new System.Windows.Forms.Label();
this.ChkAutoAdd = new System.Windows.Forms.CheckBox(); this.ChkAutoAdd = new System.Windows.Forms.CheckBox();
this.TxtRead = new System.Windows.Forms.TextBox(); this.TxtRead = new System.Windows.Forms.TextBox();
this.textBox_start = new System.Windows.Forms.TextBox();
((System.ComponentModel.ISupportInitialize)(this.NudNumber)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.NudNumber)).BeginInit();
this.SuspendLayout(); this.SuspendLayout();
// //
...@@ -111,19 +111,10 @@ namespace RFID_PuYue_Debug ...@@ -111,19 +111,10 @@ namespace RFID_PuYue_Debug
this.BtnManual.UseVisualStyleBackColor = true; this.BtnManual.UseVisualStyleBackColor = true;
this.BtnManual.Click += new System.EventHandler(this.BtnManual_Click); this.BtnManual.Click += new System.EventHandler(this.BtnManual_Click);
// //
// CboLetter
//
this.CboLetter.Font = new System.Drawing.Font("宋体", 11F);
this.CboLetter.FormattingEnabled = true;
this.CboLetter.Location = new System.Drawing.Point(178, 84);
this.CboLetter.Name = "CboLetter";
this.CboLetter.Size = new System.Drawing.Size(77, 23);
this.CboLetter.TabIndex = 6;
//
// NudNumber // NudNumber
// //
this.NudNumber.Font = new System.Drawing.Font("宋体", 10F); this.NudNumber.Font = new System.Drawing.Font("宋体", 10F);
this.NudNumber.Location = new System.Drawing.Point(261, 84); this.NudNumber.Location = new System.Drawing.Point(279, 84);
this.NudNumber.Maximum = new decimal(new int[] { this.NudNumber.Maximum = new decimal(new int[] {
255, 255,
0, 0,
...@@ -135,7 +126,7 @@ namespace RFID_PuYue_Debug ...@@ -135,7 +126,7 @@ namespace RFID_PuYue_Debug
0, 0,
0}); 0});
this.NudNumber.Name = "NudNumber"; this.NudNumber.Name = "NudNumber";
this.NudNumber.Size = new System.Drawing.Size(77, 23); this.NudNumber.Size = new System.Drawing.Size(59, 23);
this.NudNumber.TabIndex = 7; this.NudNumber.TabIndex = 7;
this.NudNumber.Value = new decimal(new int[] { this.NudNumber.Value = new decimal(new int[] {
1, 1,
...@@ -213,19 +204,27 @@ namespace RFID_PuYue_Debug ...@@ -213,19 +204,27 @@ namespace RFID_PuYue_Debug
this.TxtRead.Size = new System.Drawing.Size(308, 202); this.TxtRead.Size = new System.Drawing.Size(308, 202);
this.TxtRead.TabIndex = 13; this.TxtRead.TabIndex = 13;
// //
// textBox_start
//
this.textBox_start.Location = new System.Drawing.Point(178, 84);
this.textBox_start.Name = "textBox_start";
this.textBox_start.Size = new System.Drawing.Size(95, 21);
this.textBox_start.TabIndex = 14;
this.textBox_start.Text = "AA0000";
//
// FrmMain // FrmMain
// //
this.AcceptButton = this.BtnWrite; this.AcceptButton = this.BtnWrite;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(664, 226); this.ClientSize = new System.Drawing.Size(664, 226);
this.Controls.Add(this.textBox_start);
this.Controls.Add(this.TxtRead); this.Controls.Add(this.TxtRead);
this.Controls.Add(this.ChkAutoAdd); this.Controls.Add(this.ChkAutoAdd);
this.Controls.Add(this.LblRfid); this.Controls.Add(this.LblRfid);
this.Controls.Add(this.BtnRead); this.Controls.Add(this.BtnRead);
this.Controls.Add(this.LblMode); this.Controls.Add(this.LblMode);
this.Controls.Add(this.BtnWrite); this.Controls.Add(this.BtnWrite);
this.Controls.Add(this.CboLetter);
this.Controls.Add(this.NudNumber); this.Controls.Add(this.NudNumber);
this.Controls.Add(this.BtnAutoMode); this.Controls.Add(this.BtnAutoMode);
this.Controls.Add(this.BtnManual); this.Controls.Add(this.BtnManual);
...@@ -254,7 +253,6 @@ namespace RFID_PuYue_Debug ...@@ -254,7 +253,6 @@ namespace RFID_PuYue_Debug
private System.Windows.Forms.Button BtnInit; private System.Windows.Forms.Button BtnInit;
private System.Windows.Forms.Button BtnAutoMode; private System.Windows.Forms.Button BtnAutoMode;
private System.Windows.Forms.Button BtnManual; private System.Windows.Forms.Button BtnManual;
private System.Windows.Forms.ComboBox CboLetter;
private System.Windows.Forms.NumericUpDown NudNumber; private System.Windows.Forms.NumericUpDown NudNumber;
private System.Windows.Forms.Button BtnWrite; private System.Windows.Forms.Button BtnWrite;
private System.Windows.Forms.Label LblMode; private System.Windows.Forms.Label LblMode;
...@@ -262,6 +260,7 @@ namespace RFID_PuYue_Debug ...@@ -262,6 +260,7 @@ namespace RFID_PuYue_Debug
private System.Windows.Forms.Label LblRfid; private System.Windows.Forms.Label LblRfid;
private System.Windows.Forms.CheckBox ChkAutoAdd; private System.Windows.Forms.CheckBox ChkAutoAdd;
private System.Windows.Forms.TextBox TxtRead; private System.Windows.Forms.TextBox TxtRead;
private System.Windows.Forms.TextBox textBox_start;
} }
} }
...@@ -44,11 +44,11 @@ namespace RFID_PuYue_Debug ...@@ -44,11 +44,11 @@ namespace RFID_PuYue_Debug
private void FrmMain_Load(object sender, EventArgs e) private void FrmMain_Load(object sender, EventArgs e)
{ {
string[] letter = new string[26]; //string[] letter = new string[26];
for (int i = 0; i < letter.Length; i++) //for (int i = 0; i < letter.Length; i++)
letter[i] = ((char)(65 + i)).ToString(); // letter[i] = ((char)(65 + i)).ToString();
CboLetter.Items.AddRange(letter); //CboLetter.Items.AddRange(letter);
CboLetter.SelectedIndex = 0; //CboLetter.SelectedIndex = 0;
Frm_moduleselect frm_Moduleselect = new Frm_moduleselect(); Frm_moduleselect frm_Moduleselect = new Frm_moduleselect();
frm_Moduleselect.ShowDialog(); frm_Moduleselect.ShowDialog();
if (frm_Moduleselect.Module == Asa.RFID.ModuleEnum.FR540SP) if (frm_Moduleselect.Module == Asa.RFID.ModuleEnum.FR540SP)
...@@ -114,8 +114,12 @@ namespace RFID_PuYue_Debug ...@@ -114,8 +114,12 @@ namespace RFID_PuYue_Debug
private void BtnWrite_Click(object sender, EventArgs e) private void BtnWrite_Click(object sender, EventArgs e)
{ {
string id = CboLetter.Text + NudNumber.Value; var format = textBox_start.Text;
bool rtn = rfid.WriteData(id); var nf = format.TrimEnd('0');
var num = format.Substring(nf.Length);
string id = nf + NudNumber.Value.ToString(num);
bool rtn = rfid.WriteData(Encoding.ASCII.GetBytes(id));
if (rtn) if (rtn)
{ {
LblRfid.Text = "Write:" + id; LblRfid.Text = "Write:" + id;
...@@ -128,7 +132,7 @@ namespace RFID_PuYue_Debug ...@@ -128,7 +132,7 @@ namespace RFID_PuYue_Debug
private void BtnRead_Click(object sender, EventArgs e) private void BtnRead_Click(object sender, EventArgs e)
{ {
bool rtn = rfid.ReadData(out string id); bool rtn = rfid.ReadData(out string id,20);
if (rtn) if (rtn)
LblRfid.Text = "Read:" + id; LblRfid.Text = "Read:" + id;
else else
......
...@@ -229,11 +229,81 @@ ...@@ -229,11 +229,81 @@
<param name="address"></param> <param name="address"></param>
<param name="value"></param> <param name="value"></param>
</member> </member>
<member name="E:PuYueRFID_FR540SP_C2S.ConnectionState_Event">
<summary>
连接状态变化, 手动连接不触发
</summary>
</member>
<member name="M:PuYueRFID_FR540SP_C2S.Finalize">
<summary>
销毁
</summary>
</member>
<member name="M:PuYueRFID_FR540SP_C2S.Open">
<summary>
打开IO
</summary>
<returns></returns>
</member>
<member name="P:PuYueRFID_FR540SP_C2S.AntennaPower">
<summary>
设置天线功率dBm
</summary>
</member>
<member name="M:PuYueRFID_FR540SP_C2S.Close">
<summary>
关闭IO
</summary>
</member>
<member name="P:PuYueRFID_FR540SP_C2S.IsConn">
<summary>
连接状态
</summary>
</member>
<member name="M:PuYueRFID_FR540SP_C2S.iomonitor">
<summary>
循环读全部IO
</summary>
</member>
<member name="M:PuYueRFID_FR540SP_C2S.WriteDO(System.Int16,System.Int16)">
<summary>
写寄存器
</summary>
<param name="address"></param>
<param name="value"></param>
<returns></returns>
</member>
<member name="M:PuYueRFID_FR540SP_C2S.ReadDO">
<summary>
读全部IO
</summary>
</member>
<member name="M:PuYueRFID_FR540SP_C2S.TryRead(System.String@,System.Double@)">
<summary>
读取rfid
</summary>
<param name="id">读取到的id</param>
<param name="ms">最后读到的时间ms</param>
<returns>读取成功状态-1读取失败,0没有读到,1读取成功</returns>
</member>
<member name="M:PuYueRFID_FR540SP_C2S.WriteByte(System.Int16,System.Byte[])">
<summary>
写入字节最大 64字
</summary>
<param name="address"></param>
<param name="data"></param>
<returns></returns>
</member>
<member name="E:PuYueRFID_C2S.ConnectionState_Event"> <member name="E:PuYueRFID_C2S.ConnectionState_Event">
<summary> <summary>
连接状态变化, 手动连接不触发 连接状态变化, 手动连接不触发
</summary> </summary>
</member> </member>
<member name="M:PuYueRFID_C2S.Finalize">
<summary>
销毁
</summary>
</member>
<member name="M:PuYueRFID_C2S.Open"> <member name="M:PuYueRFID_C2S.Open">
<summary> <summary>
打开IO 打开IO
...@@ -281,5 +351,13 @@ ...@@ -281,5 +351,13 @@
<param name="ms">最后读到的时间ms</param> <param name="ms">最后读到的时间ms</param>
<returns>读取成功状态-1读取失败,0没有读到,1读取成功</returns> <returns>读取成功状态-1读取失败,0没有读到,1读取成功</returns>
</member> </member>
<member name="M:PuYueRFID_C2S.WriteByte(System.Int16,System.Byte[])">
<summary>
写入字节最大 64字
</summary>
<param name="address"></param>
<param name="data"></param>
<returns></returns>
</member>
</members> </members>
</doc> </doc>
此文件类型无法预览
[2021-06-18 13:03:48,977][1][HiStation:60]INFO =====Init=====
[2021-03-18 15:15:53,132][1][HiStation:60]INFO =====Init=====
[2021-04-09 19:08:02,697][1][HiStation:60]INFO =====Init=====
[2021-06-17 10:01:00,549][1][HiStation:60]INFO =====Init=====
...@@ -34,6 +34,7 @@ namespace Test ...@@ -34,6 +34,7 @@ namespace Test
this.timer1 = new System.Windows.Forms.Timer(this.components); this.timer1 = new System.Windows.Forms.Timer(this.components);
this.button1 = new System.Windows.Forms.Button(); this.button1 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button(); this.button2 = new System.Windows.Forms.Button();
this.button3 = new System.Windows.Forms.Button();
this.SuspendLayout(); this.SuspendLayout();
// //
// textBox1 // textBox1
...@@ -70,12 +71,23 @@ namespace Test ...@@ -70,12 +71,23 @@ namespace Test
this.button2.UseVisualStyleBackColor = true; this.button2.UseVisualStyleBackColor = true;
this.button2.Click += new System.EventHandler(this.button2_Click); this.button2.Click += new System.EventHandler(this.button2_Click);
// //
// button3
//
this.button3.Location = new System.Drawing.Point(87, 367);
this.button3.Name = "button3";
this.button3.Size = new System.Drawing.Size(75, 23);
this.button3.TabIndex = 2;
this.button3.Text = "button3";
this.button3.UseVisualStyleBackColor = true;
this.button3.Click += new System.EventHandler(this.button3_Click);
//
// Form1 // Form1
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(567, 450); this.ClientSize = new System.Drawing.Size(567, 450);
this.Controls.Add(this.button2); this.Controls.Add(this.button2);
this.Controls.Add(this.button3);
this.Controls.Add(this.button1); this.Controls.Add(this.button1);
this.Controls.Add(this.textBox1); this.Controls.Add(this.textBox1);
this.Name = "Form1"; this.Name = "Form1";
...@@ -93,6 +105,7 @@ namespace Test ...@@ -93,6 +105,7 @@ namespace Test
private System.Windows.Forms.Timer timer1; private System.Windows.Forms.Timer timer1;
private System.Windows.Forms.Button button1; private System.Windows.Forms.Button button1;
private System.Windows.Forms.Button button2; private System.Windows.Forms.Button button2;
private System.Windows.Forms.Button button3;
} }
} }
...@@ -103,5 +103,33 @@ namespace Test ...@@ -103,5 +103,33 @@ namespace Test
} }
textBox1.Text += Encoding.ASCII.GetString(data); textBox1.Text += Encoding.ASCII.GetString(data);
} }
private void button3_Click(object sender, EventArgs e)
{
i++;
txtdata += i.ToString();
var d = Encoding.ASCII.GetBytes(txtdata);
byte[] data;
while (!py.ReadByte(0x200, 1, out data))
{
textBox1.Text += "1";
Thread.Sleep(100);
}
textBox1.Text = "get tag;";
while (!py.WriteByte(0x20, d))
{
textBox1.Text += "e";
Thread.Sleep(100);
}
Thread.Sleep(500);
while (!py.ReadByte(0x255, (short)d.Length, out data))
{
textBox1.Text += "1";
Thread.Sleep(100);
}
textBox1.Text += Encoding.ASCII.GetString(data);
}
} }
} }
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!