private void BtnPanCtrl_Click(object sender, EventArgs e) { if (!Panstart) { Turntable.Instance.Start(); speed = speed < 1000 ? 1000 : speed; PCI408.PCI408_write_SEVON_PIN(Card.cardNo, Card.On); PCI408.PCI408_set_profile(Card.cardNo, 1000, speed, Card.acc, Card.acc); PCI408.PCI408_vmove(Card.cardNo, 0, Card.maxspeed); PCI408.PCI408_write_outbit(Card.cardNo, Card.chuiqizongkaiguan, Card.On); BtnPanCtrl.Text = "停止运动"; } else { Turntable.Instance.Stop(); PCI408.PCI408_decel_stop(Card.cardNo, Card.acc); PCI408.PCI408_write_outbit(Card.cardNo, Card.chuiqizongkaiguan, Card.Off); Thread.Sleep(5000); BtnPanCtrl.Text = "转盘启动测试"; } Panstart = !Panstart; }
void zhizhenLowSensor_OnTimerEvent(object sender, EventArgs e) { int state = PCI408.PCI408_read_inbit(Card.cardNo, Card.zhizhenSensor); if (state != Card.On) { SpeedTime.Start(); PCI408.PCI408_write_SEVON_PIN(Card.cardNo, Card.On); PCI408.PCI408_set_profile(Card.cardNo, Card.minspeed, Card.maxspeed, Card.acc, Card.acc); PCI408.PCI408_vmove(Card.cardNo, 0, Card.maxspeed); PCI408.PCI408_write_outbit(Card.cardNo, Card.chuiqizongkaiguan, Card.On); zhuanpanStateRuning = true; zhizhenLowSensor.timer.Stop(); } }