public Turntable() { wkb = new HSSFWorkbook(); sheet = wkb.CreateSheet("检测结果(Measure Data)"); tjcjg = DateTime.Now; sheetrr = sheet.CreateRow(sheetr); xjzsr[0] = 2; xjzsr[1] = 34; xjzsr[2] = 30; //31 xjzsr[3] = 3; //21 xjzsr[4] = 4; //32 sheetcc = sheetrr.CreateCell(sheetc); watchdog.OnTimerEvent += new MyTimer.OnTimerEventHandler(watchdog_OnTimerEvent); zhuanPanIsRun = false; zhizhenLowSensor = new MyTimer(); StartDelay.OnTimerEvent += new MyTimer.OnTimerEventHandler(StartDelay_OnTimerEvent); zhizhenLowSensor.OnTimerEvent += new MyTimer.OnTimerEventHandler(zhizhenLowSensor_OnTimerEvent); MySerialPort = new SerialPort(); MySerialPort.DataReceived += new SerialDataReceivedEventHandler(MySerialPort_DataReceived); isbussy = false; nutqueue = new List <Nut>(); isStart = false; jcqdls = new jcqdl[5]; bjgd = new long[5]; for (int jcqdlsl = 0; jcqdlsl < 5; jcqdlsl++) { jcqdls[jcqdlsl] = new jcqdl(); jcqdls[jcqdlsl].xjjcqdl = new Queue <long>(); bjgd[jcqdlsl] = 0; } xjfws = new xjfw[7]; for (int xjfwi = 0; xjfwi < 5; xjfwi++) { xjfws[xjfwi] = new xjfw(); xjfws[xjfwi].ID = xjfwi; xjfws[xjfwi].t1 = DateTime.Now; xjfws[xjfwi].t2 = DateTime.Now; } copos = new coppos[7]; for (int k = 0; k < 5; k++) { copos[k] = new coppos(); copos[k].ID = k; // copos[k].onwrite = false; } timers = new MyTimer[7]; for (int i = 0; i < timers.Length; i++) { timers[i] = new MyTimer(); timers[i].ID = i; //timers[i].OnTimerEvent += new MyTimer.OnTimerEventHandler(OnTimer); } dpdl = new List <int> [5]; for (int i = 0; i < 5; i++) { dpdl[i] = new List <int>(); } for (ushort i = 0; i < 9; i++) { PCI408.PCI408_write_outbit(Card.cardNo, (ushort)(Card.Out1 + i), Card.Off); } PCI408.PCI408_set_position(Card.cardNo, 0); PCI408.PCI408_set_pulse_outmode(Card.cardNo, 0); //SpeedTime.Tick += new EventHandler(SpeedTime_OnTime); SpeedTime.Enabled = true; SpeedTime.Interval = 5000; zhuanpanStateRuning = false; //if (!MySerialPort.IsOpen) //{ // MySerialPort.BaudRate = 9600; // MySerialPort.StopBits = StopBits.One; // MySerialPort.Parity = Parity.None; // MySerialPort.PortName = "COM1"; // MySerialPort.DataBits = 8; // MySerialPort.ReceivedBytesThreshold = 21; // MySerialPort.ReadBufferSize = 512; // MySerialPort.Open(); //} }