public static void closeBoard() { mServoIo.check_flag = 1; for (int i = 0; i < AXIS_NUM; ++i) { RFIDControl.dmc_write_sevon_pin(mAxis[i].m_card_num, mAxis[i].m_axis_num, HIGH); //伺服OFF RFIDControl.dmc_set_inp_mode(mAxis[i].m_card_num, mAxis[i].m_axis_num, LOW, LOW); //设置伺服 INP 低电平有效 RFIDControl.dmc_set_alm_mode(mAxis[i].m_card_num, mAxis[i].m_axis_num, LOW, HIGH, 0); //设置 伺服ALM 高电平有效 松下伺服正常情况下输出低电平 } RFIDControl.dmc_board_close(); }
public static short initBoard()//初始化办卡 返回值:-1:没有卡号 0:正常 { short m = RFIDControl.dmc_board_init(); if (m <= 0) //控制卡的初始化操作 { //未找到控制卡 Console.WriteLine("未找到控制卡"); return(-1); } for (int i = 0; i < AXIS_NUM; ++i) { mAxis[i] = new AxisInfo(); mAxis[i].m_card_num = 0; mAxis[i].m_axis_num = (ushort)i; mAxis[i].m_home_mode = 1; //一次回零加回找 mAxis[i].m_home_flag = 0; mAxis[i].m_acc_time = 0.4; mAxis[i].m_dcc_time = 0.4; mAxis[i].m_home_dir = MoveDir.FOR_WORD; mAxis[i].m_speed_max = 10000; //dispenser_para.motor_speed; mAxis[i].m_speed_max_home = 2000; //dispenser_para.go_home_speed; mAxis[i].m_pulse_mode = 3; mAxis[i].m_speed_min = 0; mAxis[i].m_speed_min_home = 0; mAxis[i].m_run_status = STOP;//停止状态 if (i < 2) { RFIDControl.dmc_set_inp_mode(mAxis[i].m_card_num, mAxis[i].m_axis_num, HIGH, LOW); RFIDControl.dmc_set_alm_mode(mAxis[i].m_card_num, mAxis[i].m_axis_num, HIGH, HIGH, 0); //设置 伺服ALM 高电平有效 松下伺服正常情况下输出低电平 RFIDControl.dmc_set_counter_inmode(mAxis[i].m_card_num, mAxis[i].m_axis_num, 1); //设置编码器的计数方式 1倍频 RFIDControl.dmc_set_encoder(mAxis[i].m_card_num, mAxis[i].m_axis_num, 0); //设置初始值为0 } } //两轴查补 mInpterplaType.axis_cout = 2; //2个轴查补 mInpterplaType.car_num = 0; //坐标系号 mInpterplaType.card_num = 0; //卡号 mInpterplaType.line_type = 0; //线型 mInpterplaType.posi_mode = PositionMode.ABS_MODE; //位置模式 mInpterplaType.m_acc_time = 3; mInpterplaType.m_dcc_time = 3; mInpterplaType.m_speed_max = X_AXIS_MAX_SPEED; mInpterplaType.arc_dir = CCW; return(0); }