110,536
社区成员
发帖
与我相关
我的任务
分享
.......初始化
while (d == 0)//这里等待并口信号
{
WinIO.GetPortVal((IntPtr)0x378, out d, 1);
}
}
private void timer1_Tick(object sender, EventArgs e)
{
int temp = Convert.ToInt32(lb_TimeCounter.Text);
temp = temp - 1;
lb_TimeCounter.Text = Convert.ToString(temp);
lb_TimeCounter.Refresh();
if (temp == 0)
this.Close();
}
while (d == 0)//这里等待并口信号
{
WinIO.GetPortVal((IntPtr)0x378, out d, 1);
Application.DoEvents();
}
DateTime DT = DateTime.Now;
while ((d&0xFF) == 0xFF)//等待触发信号
{
WinIO.GetPortVal((IntPtr)0x378, out d, 1);
TimeDiff = DateTime.Now - DT;
lb_TimeCounter.Text = Convert.ToString(10-TimeDiff.Seconds);
lb_TimeCounter.Refresh();
if (TimeDiff.Seconds == 10) break;
}
this.Close();