#include "global.h" #if JU_XING_MACHINE == 1 void TBJ_InitAction(void); void TBJ_Action(void); void TBJ_ChuiQi(void); void TBJ_ChaoShengHeMo(void); void TBJ_SetAlarmCode(unsigned alarm_code); //等待调用 void TBJ_StartStopAction(void); void TBJ_AutoRunStep(void); void TBJ_Motor(void); void TBJ_SongJiao(void); void TBJ_STOP_Action(void); void TBJ_ChuiQi_Stop(void); void TBJ_Action(void) { //步骤显示 DISPLAY_DATA0 = TBJ_Auto_Step; DISPLAY_DATA1 = TBJ_Motor_Step; DISPLAY_DATA2 = TBJ_HMCS_Step; DISPLAY_DATA3 = TBJ_SJ_FJ_Step; DISPLAY_DATA4 = TBJ_SAVE_POS; DISPLAY_DATA5 = GetPos(X_AXIS); // InputPinConfig(); TBJ_ManualAction(); TBJ_ChaoShengHeMo(); TBJ_StartStopAction(); TBJ_AutoRunStep(); TBJ_Motor(); TBJ_SongJiao(); // OutputPinConfig(); TBJ_STOP_Action(); TBJ_ChuiQi_Stop(); } //故障报警 void TBJ_SetAlarmCode(unsigned alarm_code) { SetAlarmCode(TBJ_ALARM_ADDR, alarm_code); TBJ_bAlarmStop = 1; } void TBJ_InitAction(void) { float buff_pulse, buff_dist; //电机松轴 SetEn(X_AXIS, TBJ_MOTOR_DISEN); //电机脉冲与距离比例计算 buff_pulse = TBJ_PARAM_CYCLE_PULSE; //电机走一圈所需的脉冲 buff_dist = TBJ_PARAM_CYCLE_LENGTH; //电机走一圈长度 XGearRatio = buff_pulse / buff_dist; //可根据距离换算所需脉冲,反之一样 TBJ_CHENGXU_UPDATE = 1; //便于屏幕判断程序有无更新 SetDirReverse(X_AXIS, 0); SetAlarmCode(TBJ_ALARM_ADDR, TBJ_NO_ALARM); //警告要清除 } //吹气 void TBJ_ChuiQi(void) { if (!TBJ_CQ_VAVLE) { TBJ_CQ_VAVLE = 1; TBJ_CQ_Delay = dwTickCount + TBJ_PARAM_ChuiQi_TIME; } } //停止吹气 void TBJ_ChuiQi_Stop(void) { if (TBJ_CQ_VAVLE && dwTickCount >= TBJ_CQ_Delay && dwTickCount >= TBJ_CS_Delay) TBJ_CQ_VAVLE = 0; } //红外算出来的时间重新赋值 void TBJ_ResetCsTime(void) { if (TBJ_PARAM_CS_MODE == 0) user_datas[33] = user_datas[57]; else user_datas[6] = user_datas[57]; } //超声时间选择 unsigned short TBJ_Choose_CSTime(void) { if (TBJ_PARAM_CS_MODE == 0) //超声模式 0为透明胶 1为布胶 return TBJ_PARAM_TMJ_CS_TIME; //透明胶超声时间 else return TBJ_PARAM_BJ_CS_TIME; //布胶超声时间 } //固化时间选择 unsigned short TBJ_Choose_COLDTime(void) { if (TBJ_PARAM_CS_MODE == 0) return TBJ_PARAM_TMJ_GH_TIME; //透明胶固化时间 else return TBJ_PARAM_BJ_GH_TIME; //布胶固化时间 } //手动动作 void TBJ_ManualAction(void) { if (!TBJ_bRunning) { //手动钩针输出 if (TBJ_HAND_GOUZHEN) //X02手动钩针触发 { //X02上升沿 送胶到位感应 单钩针模式 滚轮模式 if (TBJ_HAND_GOUZHEN_UP && (!TBJ_SJ_LIMIT_IN || TBJ_PARAM_SGZSelect || TBJ_PARAM_SongJiaoMode)) TBJ_GZ_VAVLE = 1; //钩针输出 else if (TBJ_PARAM_SGZSelect == 0) //双钩针模式 { if (TBJ_GZ_VAVLE && TBJ_TD_LIMIT_IN && !TBJ_XM_VAVLE) //钩针已输出 拖带到位感应亮 下模无输出 { TBJ_XM_VAVLE = 1; //下模输出 TBJ_GZ_Delay = dwTickCount + TBJ_PARAM_JJ_TIME; //下模输出时间 } if (TBJ_XM_VAVLE && (dwTickCount > TBJ_GZ_Delay)) { TBJ_GZ_VAVLE = 0; } } } //屏幕按钮手动钩针 if (TBJ_bGZ) { TBJ_bGZ = 0; if (TBJ_GZ_VAVLE) TBJ_GZ_VAVLE = 0; else TBJ_GZ_VAVLE = 1; } //手动分胶 if ((TBJ_HAND_FENJIAO_UP || TBJ_bFJ) && (((!TBJ_GZ_ORIGIN_IN) && (TBJ_PARAM_SGZSelect == 1)) //单钩针模式下的判断 || ((TBJ_PARAM_SGZSelect == 0) && TBJ_GZ_ORIGIN_IN && !TBJ_TD_LIMIT_IN)) //双钩针模式下的判断 && !TBJ_SM_VAVLE && !TBJ_SM_LIMIT_IN && !TBJ_HAND_CHAOSHENG //下模判断 超声未打开 && (TBJ_FJ_VAVLE || (!TBJ_SJ_VAVLE && !TBJ_SJ_LIMIT_IN && TBJ_SJ_ORIGIN_IN)) //未进分胶,送胶不能输出,进完分胶后,无视送胶状态,可退分胶 ) { TBJ_bFJ = 0; if (TBJ_FJ_VAVLE && !TBJ_HAND_FENJIAO) TBJ_FJ_VAVLE = 0; else TBJ_FJ_VAVLE = 1; } else if (TBJ_HAND_FENJIAO_DW) TBJ_FJ_VAVLE = 0; else if (TBJ_bFJ) { TBJ_bFJ = 0; if (!(((!TBJ_GZ_ORIGIN_IN) && (TBJ_PARAM_SGZSelect == 1)) || ((TBJ_PARAM_SGZSelect == 0) && TBJ_GZ_ORIGIN_IN && !TBJ_TD_LIMIT_IN))) TBJ_SetAlarmCode(34); //E34 手动分胶停止,原因可能如下①夹胶非单独气缸,压胶阀未关闭;②单钩针模式下,钩针退位了;③双钩针模式下,钩针未退位; else if (TBJ_SM_VAVLE) TBJ_SetAlarmCode(35); //E35 手动分胶停止,下冲气缸未退位 else if (TBJ_SM_LIMIT_IN) TBJ_SetAlarmCode(36); //E36 手动分胶停止,下冲气缸未退位或X14下冲到位感应异常 else if (TBJ_HAND_CHAOSHENG) TBJ_SetAlarmCode(37); //E37 手动分胶停止,超声未关闭 else if (TBJ_SJ_LIMIT_IN) TBJ_SetAlarmCode(38); //E38 手动分胶停止,送胶阀未退回,或X16送胶到位感应异常 else if (!TBJ_SJ_ORIGIN_IN) TBJ_SetAlarmCode(39); //E39 手动分胶停止,送胶阀未退回,或X17退胶到位感应异常 } //手动送胶 if ((TBJ_HAND_SONGJIAO_UP || (TBJ_bSJ && !TBJ_SJ_VAVLE))) //按钮按下 送胶阀未输出 进行送胶 { //手动送胶 || (按钮送胶 && 送胶阀没输出)&& (!1二次拖带的情况下考虑钩针阀没有输出) if ((TBJ_PARAM_SGZSelect || (TBJ_GZ_ORIGIN_IN && !TBJ_TD_LIMIT_IN)) //单钩针模式,钩针与送胶阀错位,不用考虑相撞,双钩针模式下的判断,钩针钩住拖带后退,可能会与送胶阀产生碰撞 && (TBJ_FJ_LIMIT_IN ^ TBJ_FJ_ORIGIN_IN) && TBJ_SJ_ORIGIN_IN //判断分胶阀有无出错,只能到位或原位 送胶阀后感应亮 && !TBJ_SM_VAVLE && !TBJ_SM_LIMIT_IN && !TBJ_HAND_CHAOSHENG //上模判断 超声未打开 && (!TBJ_PARAM_TWOTD_SELECT || !TBJ_GZ_VAVLE)) //二次拖带下需考虑钩针有无退回 { if (!TBJ_YD_VAVLE) //压胶阀没输出 { TBJ_YD_VAVLE = 1; //压胶阀输出 TBJ_SJ_Delay = dwTickCount + 70; //延迟70ms输出送胶阀 } else if (TBJ_YD_VAVLE && (dwTickCount > TBJ_SJ_Delay)) { TBJ_SJ_VAVLE = 1; //送胶阀输出 TBJ_bSJ = 0; } } else if (TBJ_bSJ) //送胶失败,发送警告 { TBJ_bSJ = 0; if (!(TBJ_PARAM_SGZSelect || (TBJ_GZ_ORIGIN_IN && !TBJ_TD_LIMIT_IN))) TBJ_SetAlarmCode(40); //E40 手动送胶停止,双钩针模式下钩针未退回 else if (!(TBJ_FJ_LIMIT_IN ^ TBJ_FJ_ORIGIN_IN)) TBJ_SetAlarmCode(41); //E41 手动送胶停止,分胶阀处于异常状态,X12,X13前后感应灯同亮或同灭 else if (!TBJ_SJ_VAVLE && !TBJ_SJ_ORIGIN_IN) TBJ_SetAlarmCode(42); //E42 手动送胶停止,X17送胶后感应异常 else if (TBJ_SM_VAVLE) TBJ_SetAlarmCode(43); //E43 手动送胶停止,下冲气缸输出中 else if (TBJ_SM_LIMIT_IN) TBJ_SetAlarmCode(44); //E44 手动送胶停止,下冲气缸未退回,或X14 下冲到位感应异常 else if (TBJ_HAND_CHAOSHENG) TBJ_SetAlarmCode(45); //E45 手动送胶停止,超声未关闭 if (TBJ_SJ_VAVLE) TBJ_SJ_VAVLE = 0; } } else if ((TBJ_HAND_SONGJIAO_DW || (TBJ_bSJ && TBJ_SJ_VAVLE))) //送胶阀已输出,进行退胶 { if (TBJ_YD_VAVLE) { TBJ_YD_VAVLE = 0; //压胶阀关闭 TBJ_SJ_Delay = dwTickCount + 120; //延迟120ms退回送胶阀 } else if (!TBJ_YD_VAVLE && (dwTickCount > TBJ_SJ_Delay)) { TBJ_SJ_VAVLE = 0; TBJ_bSJ = 0; } } //手动合模 if ((TBJ_bHM || TBJ_HAND_HEMO_UP) && !TBJ_SM_VAVLE) //屏幕按钮按下 || 上模没输出 && 手动合模输入 { if ((TBJ_HAND_HEMO_UP || TBJ_bHM) && (TBJ_FJ_ORIGIN_IN || TBJ_PARAM_FenJiaoSelect) && (!TBJ_FJ_LIMIT_IN) //分胶阀感应判断 && (((!TBJ_SJ_LIMIT_IN) && TBJ_SJ_ORIGIN_IN) || (TBJ_PARAM_SongJiaoMode)) //送胶阀感应判断 && (!TBJ_FJ_VAVLE) && (!TBJ_SJ_VAVLE) && (!TBJ_CS_OUT) //分胶阀判断 送胶阀判断 超声判断 && ((TBJ_GZ_ORIGIN_IN && !TBJ_TD_LIMIT_IN) || TBJ_PARAM_SGZSelect)) //双钩针模式需考虑钩针有无输出 { TBJ_SM_VAVLE = 1; if (TBJ_PARAM_XiaMo_Mode == 0) //下模活动 { TBJ_XM_VAVLE = 1; } TBJ_Hand_Hemo_flag = 1; TBJ_bHM = 0; } else if (TBJ_bHM) { TBJ_bHM = 0; if (!(TBJ_FJ_ORIGIN_IN)) TBJ_SetAlarmCode(46); //E46 手动合模停止,分胶阀未退位,或 X13分胶后感应异常 else if (TBJ_FJ_LIMIT_IN) TBJ_SetAlarmCode(47); //E47 手动合模停止,分胶阀未退位,或 X12分胶前感应异常 else if (TBJ_SJ_LIMIT_IN) TBJ_SetAlarmCode(48); //E48 手动合模停止,送胶阀未退位,或 X16送胶前感应异常 else if (!TBJ_SJ_ORIGIN_IN) TBJ_SetAlarmCode(49); //E49 手动合模停止,送胶阀未退位,或 X17分胶后感应异常 else if (TBJ_CS_OUT) TBJ_SetAlarmCode(50); //E50 手动合模停止,超声未关闭 } } else if ((TBJ_bHM || TBJ_HAND_HEMO_UP) && TBJ_SM_VAVLE) //屏幕按钮按下 && 上模已输出 && 手动合模没输入 { TBJ_SM_VAVLE = 0; //上模退回 if (TBJ_PARAM_XiaMo_Mode == 0) //双钩针模式下 或下模活动模式 { TBJ_XM_VAVLE = 0; //下模退回 } TBJ_bHM = 0; } //合模后吹气一次 if (TBJ_SM_LIMIT_IN && TBJ_Hand_Hemo_flag) //合模到位 { TBJ_ChuiQi(); //启动吹气 TBJ_Hand_Hemo_flag = 0; } //手动超声 if (TBJ_HAND_CHAOSHENG || ((TBJ_bCS || TBJ_bCS_FLAG) && !TBJ_HAND_CHAOSHENG_DW) && (!TBJ_FJ_VAVLE && !TBJ_FJ_LIMIT_IN && TBJ_FJ_ORIGIN_IN || TBJ_PARAM_FenJiaoSelect) //分胶阀判断 && (!TBJ_SJ_VAVLE && !TBJ_SJ_LIMIT_IN && TBJ_SJ_ORIGIN_IN || TBJ_PARAM_SongJiaoMode) //送胶阀判断 && (dwTickCount >= TBJ_CS_Delay) //超声间隔 ) { if ((TBJ_GZ_ORIGIN_IN && TBJ_TD_LIMIT_IN || TBJ_PARAM_SGZSelect) && !TBJ_SHANGCHAO_IN && !TBJ_bSC_FLAG) //钩针阀判断 { if (TBJ_PARAM_XiaMo_Mode) //下模不动 超声不烧坏焊头 { if (TBJ_SM_LIMIT_IN) //已经合模 { if ((TBJ_HAND_CHAOSHENG_UP || TBJ_bCS) && (TBJ_HMCS_Step == 0)) { TBJ_HMCS_Step = 3; //直接发超声(按设定时间) TBJ_bCS_FLAG = 1; } } else //直接超声 { if ((TBJ_HAND_CHAOSHENG_UP || TBJ_bCS) && !TBJ_bCS_FLAG) //按钮已按下,超声未开始 { TBJ_bCS_FLAG = 1; //cMidleCoil[0] |= (1<<10); //M10 TBJ_CS_OUT = 1; //发超声 TBJ_CS_Delay = dwTickCount + TBJ_Choose_CSTime(); //限长时间1.5 } else if (((!TBJ_bCS && !TBJ_HAND_CHAOSHENG) || (dwTickCount >= TBJ_CS_Delay)) && TBJ_CS_OUT) //直至按钮取消或到达超声时间 关闭超声 { TBJ_bCS = 0; TBJ_bCS_FLAG = 0; //超声标志位清零 TBJ_CS_OUT = 0; //关闭超声 TBJ_ChuiQi(); //开启吹气 } } } /*下模活动 取消注释*/ // else if(TBJ_PARAM_SGZSelect == 1)//下模活动,勾针为单勾针,超声会烧坏焊头,需要合模才能超声 // { // if((TBJ_HAND_CHAOSHENG_UP || TBJ_bCS) && !TBJ_XM_VAVLE)//下模未输出 // { // TBJ_bCS = 1; // TBJ_XM_VAVLE = 1; // 输出下模,需合模才能超声 // TBJ_CS_Delay = dwTickCount + 100; // 下模上升时间 // } // if(TBJ_XM_VAVLE && TBJ_SM_LIMIT_IN_UP && !TBJ_bCS_FLAG && (dwTickCount >= TBJ_CS_Delay))//老款下模启动 上模到位 // { // TBJ_bCS_FLAG = 1; // TBJ_CS_OUT = 1; //发超声 // TBJ_CS_Delay = dwTickCount + 2000; //限长时间2秒 // } // if((!TBJ_bCS || (dwTickCount >= TBJ_CS_Delay)) && TBJ_CS_OUT) // { // TBJ_bCS = 0; // TBJ_CS_OUT = 0; // TBJ_HMCS_Step = 4; // } // } //超声完成 if (!TBJ_bCS && !TBJ_CS_OUT && !TBJ_HAND_CHAOSHENG) //按钮清零 超声关闭 手动超声关闭 { TBJ_bCS_FLAG = 0; //cMidleCoil[0] &= ~(1<<10); //M10 TBJ_HMCS_Step = 0; if (TBJ_PARAM_XiaMo_Mode == 0) //下模活动 { TBJ_XM_VAVLE = 0; //退回下模 } } } else TBJ_bCS = 0; } else if (TBJ_HAND_CHAOSHENG_DW) { TBJ_bCS_FLAG = 0; //超声标志清零 TBJ_bCS = 0; //超声按钮清零 TBJ_CS_OUT = 0; //关闭超声 TBJ_HMCS_Step = 0; TBJ_CS_Delay = dwTickCount + 300; if (TBJ_PARAM_XiaMo_Mode == 0) //下模活动 { TBJ_XM_VAVLE = 0; } } else if (TBJ_bCS) { TBJ_bCS = 0; if (TBJ_FJ_VAVLE) TBJ_SetAlarmCode(51); //E51 手动超声停止,分胶阀未退回 else if (TBJ_SJ_VAVLE) TBJ_SetAlarmCode(52); //E52 手动超声停止,送胶阀未退回 else if (TBJ_FJ_LIMIT_IN) TBJ_SetAlarmCode(53); //E53 手动超声停止,分胶阀未退回,或X12分胶前感应异常 else if (!TBJ_FJ_ORIGIN_IN && !TBJ_PARAM_FenJiaoSelect) TBJ_SetAlarmCode(54); //E54 手动超声停止,分胶阀未退回,或X13分胶后感应异常 else if (TBJ_SJ_LIMIT_IN) TBJ_SetAlarmCode(55); //E55 手动超声停止,送胶阀未退回,或X16送胶到位感应异常 else if (!TBJ_SJ_ORIGIN_IN) TBJ_SetAlarmCode(56); //E56 手动超声停止,送胶阀未退回,或X17退胶到位感应异常 } //手动上超 if (((TBJ_SHANGCHAO_IN_UP || TBJ_bSC) && !TBJ_bSC_FLAG) && (!TBJ_FJ_VAVLE && !TBJ_FJ_LIMIT_IN && TBJ_FJ_ORIGIN_IN || TBJ_PARAM_FenJiaoSelect) //分胶阀判断 && (!TBJ_SJ_VAVLE && !TBJ_SJ_LIMIT_IN && TBJ_SJ_ORIGIN_IN || TBJ_PARAM_SongJiaoMode) //送胶阀判断 && (dwTickCount >= TBJ_CS_Delay)) //超声间隔 { if (!TBJ_TD_LIMIT_IN && TBJ_GZ_ORIGIN_IN || TBJ_PARAM_SGZSelect) { TBJ_bSC_FLAG = 1; TBJ_HMCS_Step = 1; //整个合模超声过程 } TBJ_bSC = 0; } else if (TBJ_SHANGCHAO_IN_DW || (TBJ_bSC_FLAG && (TBJ_HMCS_Step == 0)) || (TBJ_bSC_FLAG && TBJ_bSC)) { TBJ_bSC_FLAG = 0; TBJ_bSC = 0; TBJ_SM_VAVLE = 0; TBJ_CS_OUT = 0; TBJ_CS_Delay = dwTickCount + 300; } else if (TBJ_bSC) { if (TBJ_FJ_VAVLE) TBJ_SetAlarmCode(57); //E57 手动上超停止,分胶阀未退回 else if (TBJ_FJ_LIMIT_IN) TBJ_SetAlarmCode(58); //E58 手动上超停止,分胶阀未退回,或X12分胶前感应异常 else if (!TBJ_PARAM_FenJiaoSelect && !TBJ_FJ_ORIGIN_IN) TBJ_SetAlarmCode(59); //E59 手动上超停止,分胶阀未退回,或X13分胶后感应异常 else if (TBJ_PARAM_SongJiaoMode == 0) { if (TBJ_SJ_VAVLE) TBJ_SetAlarmCode(60); //E60 手动上超停止,送胶阀未退回 if (TBJ_SJ_LIMIT_IN) TBJ_SetAlarmCode(61); //E61 手动上超停止,送胶阀未退回,或X16送胶到位感应异常 if (!TBJ_SJ_ORIGIN_IN) TBJ_SetAlarmCode(62); //E62 手动上超停止,送胶阀未退回,或X17退胶到位感应异常 } TBJ_bSC = 0; TBJ_bSC_FLAG = 0; } //手动夹胶(压带) if (TBJ_bYD) { if (TBJ_YD_VAVLE) TBJ_YD_VAVLE = 0; else TBJ_YD_VAVLE = 1; TBJ_bYD = 0; } } } //送胶动作 void TBJ_SongJiao(void) { if (TBJ_bStop) return; switch (TBJ_SJ_FJ_Step) { case 0: break; case 1: TBJ_SJ_FJ_Step = 2; TBJ_SJ_Delay = dwTickCount + TBJ_PARAM_FJ_DELAY; break; case 2: if (dwTickCount >= TBJ_SJ_Delay) { TBJ_SJ_FJ_Step = 3; TBJ_FJ_VAVLE = 1; //分胶阀输出 TBJ_YD_VAVLE = 1; //夹胶阀输出 TBJ_FJ_Delay = dwTickCount + 60; //分胶阀输出时间 TBJ_SJ_ErrorTime = dwTickCount + ERRORTIME; //分胶阀输出容错时间 } break; case 3: if ( (dwTickCount > TBJ_FJ_Delay) ||TBJ_TEST_MODE || (!TBJ_bRunning || TBJ_OneTimes)) // { TBJ_SJ_FJ_Step = 4; } else if (!TBJ_FJ_LIMIT_IN && (dwTickCount >= TBJ_SJ_ErrorTime)) { TBJ_SetAlarmCode(10); //E10 分胶未到位或 X12分胶前感应异常,无法送胶 } break; case 4: if (TBJ_PARAM_SGZSelect || (TBJ_Motor_Step == 0)) { if (TBJ_FJ_LIMIT_IN && TBJ_FJ_VAVLE) { TBJ_SJ_FJ_Step = 5; TBJ_SJ_VAVLE = 1; //送胶输出 TBJ_SJ_ErrorTime = dwTickCount + ERRORTIME; TBJ_FJ_Delay = dwTickCount + TBJ_PARAM_SJ_TIME; } else if (dwTickCount > TBJ_SJ_ErrorTime) { TBJ_SetAlarmCode(10); //E10 分胶未到位或 X12分胶前感应异常,无法送胶 } } break; case 5: if (TBJ_SJ_LIMIT_IN_UP || (TBJ_PARAM_SongJiaoMode && TBJ_PARAM_GUNLUN_SIGN && (dwTickCount > TBJ_FJ_Delay))) { if (TBJ_bRunning) { TBJ_SJ_FJ_Step = 6; TBJ_FJ_Delay = dwTickCount + 15; } else TBJ_SJ_FJ_Step = 0; } else if (dwTickCount > TBJ_SJ_ErrorTime) { TBJ_SetAlarmCode(4); //E04 送胶不到位或 X16送胶前感应异常 } if (TBJ_NOJIAO_IN && TBJ_bRunning) { TBJ_SetAlarmCode(7); //E07 胶已用完,请补充胶 TBJ_OneTimes = 1; } break; case 6: if ((dwTickCount >= TBJ_FJ_Delay) && ((!X_DRV) || ((TBJ_Auto_Step == 2) && TBJ_GUO_LIAN_IN))) { TBJ_SJ_FJ_Step = 7; if (!TBJ_FJBACKMode) TBJ_FJ_VAVLE = 0; //关分胶 TBJ_YD_VAVLE = 0; //关夹胶 TBJ_FJ_Delay = dwTickCount + 50; TBJ_SJ_ErrorTime = dwTickCount + ERRORTIME; } break; case 7: if ((!TBJ_FJ_LIMIT_IN || (TBJ_FJBACKMode == 1)) && (dwTickCount >= TBJ_FJ_Delay) || TBJ_TEST_MODE) { TBJ_SJ_FJ_Step = 8; if ((TBJ_PARAM_SongJiaoMode == 0) || (!TBJ_bRunning)) //气缸送胶先退,滚轮送胶先不退或是触摸屏手动退送胶 TBJ_SJ_VAVLE = 0; TBJ_SJ_ErrorTime = dwTickCount + ERRORTIME; } else if (dwTickCount >= TBJ_SJ_ErrorTime) { TBJ_SetAlarmCode(6); //E06 退分胶不到位警告或 X13分胶后感应异常 } break; case 8: if (((TBJ_PARAM_SongJiaoMode == 1) || (!TBJ_SJ_LIMIT_IN && TBJ_SJ_ORIGIN_IN))) { TBJ_SJ_FJ_Step = 0; M0019 = 0; } else if (dwTickCount >= TBJ_SJ_ErrorTime) { TBJ_SetAlarmCode(5); //E05 退胶不到位警告 或 X16、X17送胶前后感应异常 } break; } } //合模超声动作 void TBJ_ChaoShengHeMo(void) { unsigned short cs_time; switch (TBJ_HMCS_Step) { case 0: break; case 1: if ((!TBJ_FJ_VAVLE) && ((!TBJ_SJ_VAVLE) || (TBJ_PARAM_SongJiaoMode)) //输出阀判断 && (!TBJ_FJ_LIMIT_IN) && (TBJ_FJ_ORIGIN_IN || TBJ_PARAM_FenJiaoSelect) //分胶阀位置判断 && (((!TBJ_SJ_LIMIT_IN) && TBJ_SJ_ORIGIN_IN) || (TBJ_PARAM_SongJiaoMode == 1)) //送胶阀位置判断 && (TBJ_GZ_ORIGIN_IN || (TBJ_PARAM_SGZSelect))) //钩针阀判断 { TBJ_SM_VAVLE = 1; // 下冲 if ((TBJ_PARAM_XiaMo_Mode == 0) && (TBJ_PARAM_SGZSelect != 0)) TBJ_XM_VAVLE = 1; TBJ_HMCS_Step = 2; TBJ_SM_ErrorTime = dwTickCount + (unsigned long)ERRORTIME; //上模下冲容错时间 } else if (!TBJ_bRunning) { TBJ_HMCS_Step = 0; } break; case 2: if (TBJ_SM_LIMIT_IN && ((TBJ_GZ_ORIGIN_IN && (TBJ_PARAM_SGZSelect != 0)) || TBJ_PARAM_XiaMo_Mode)) //1 下模不动 { TBJ_CS_Delay = dwTickCount + TBJ_PARAM_CS_DELAY; //延时超声 TBJ_HMCS_Step = 3; if (TBJ_PARAM_TuiGouZhen_Mode == 1) //0 先超声后下勾针,1 先下勾针后超声 TBJ_GZ_VAVLE = 0; } else if ((dwTickCount >= TBJ_SM_ErrorTime) && (!X14)) { TBJ_SetAlarmCode(26); //E26 超声停止,合模不到位或 X14下冲到位感应异常 } else if ((dwTickCount >= TBJ_SM_ErrorTime) && (!TBJ_GZ_ORIGIN_IN)) { TBJ_SetAlarmCode(27); //E27 超声停止,钩针不到位或 TBJ_GZ_ORIGIN_IN钩针复位感应异常 } break; case 3: if (dwTickCount >= TBJ_CS_Delay) { TBJ_bCS = 0; TBJ_CS_OUT = 1; //超声打开 cs_time = TBJ_Choose_CSTime(); if (cs_time > 1500) cs_time = 1500; //超声时间上限为1.5 S TBJ_CS_Delay = dwTickCount + cs_time; TBJ_HMCS_Step = 4; } TBJ_SJ_VAVLE = 0; break; case 4: if (dwTickCount >= TBJ_CS_Delay) { TBJ_HMCS_Step = 5; TBJ_CS_OUT = 0; TBJ_CS_Delay = dwTickCount + (TBJ_Choose_COLDTime() / 2); //固化一半时间 } break; case 5: if (dwTickCount >= TBJ_CS_Delay) { TBJ_HMCS_Step = 6; TBJ_ChuiQi(); TBJ_GZ_VAVLE = 0; TBJ_CS_Delay = dwTickCount + (TBJ_Choose_COLDTime() / 2); } break; case 6: if (dwTickCount >= TBJ_CS_Delay) { if (TBJ_PARAM_HONGWAI_GanYin != 0) { //重新算温度 cs_time = user_datas[55]; if (user_datas[39] == 0) user_datas[39] = 1; //测温值 降时间阀值 if ((cs_time >= user_datas[37]) && (cs_time >= user_datas[58])) { cs_time = (cs_time - user_datas[58]) / user_datas[39]; cs_time *= user_datas[38]; if (cs_time > 3) cs_time = 3; if ((user_datas[59] + cs_time) < 4) user_datas[59] += cs_time; else if (user_datas[59] < 4) { cs_time = 3 - user_datas[59]; user_datas[59] = 3; } else cs_time = 0; } else cs_time = 0; user_datas[57] = TBJ_Choose_CSTime(); user_datas[57] -= cs_time; TBJ_ResetCsTime(); } user_datas[56] = user_datas[55]; if (user_datas[56] > user_datas[58]) user_datas[58] = user_datas[55]; TBJ_SM_VAVLE = 0; TBJ_XM_VAVLE = 0; TBJ_HMCS_Step = 0; //TBJ_CS_Delay = dwTickCount + 350; } break; } } //启动停止故障停止动作 void TBJ_StartStopAction(void) { if ((TBJ_START_IN_UP || TBJ_bStart || TBJ_bSingle) && !TBJ_bRunning && (TBJ_Auto_Step == 0)) { if(TBJ_bSingle) { if(TBJ_GZ_VAVLE && !TBJ_PARAM_AOKO_MODE) { TBJ_bSingleone=1; TBJ_SJ_FJ_Step = 1; //开始分胶送胶,送胶分胶需电机动作完成后才能完成 TBJ_Auto_Step = 3; TBJ_bRunning = 1; TBJ_Auto_Delay = 0; } else { ; } } else { if (TBJ_NOJIAO_IN) { TBJ_SetAlarmCode(7); //E07 胶已用完,请补充胶 } else { TBJ_bSingleone=0; TBJ_Auto_Step = 1; TBJ_bRunning = 1; TBJ_Auto_Delay = 0; } } TBJ_bStart = 0; TBJ_bSingle=0; } if (TBJ_bStop) { /*当自动步骤达到4,已完成送胶动作,将本次贴胶动作做完*/ TBJ_bSingleone=0;//单循环标志位 TBJ_bSingle=0; TBJ_bStart = 0; TBJ_bRunning = 0; TBJ_bAlarmStop = 0; TBJ_bStop = 0; TBJ_HMCS_Step = 0; TBJ_Auto_Step = 0; TBJ_SJ_FJ_Step = 0; TBJ_Motor_Step = 0; AxisEgmStop(X_AXIS); //刹停电机 SetEn(X_AXIS, TBJ_MOTOR_DISEN); //松轴 TBJ_GZ_VAVLE = 0; //Y01钩针 TBJ_FJ_VAVLE = 0; //Y02分胶 TBJ_SM_VAVLE = 0; //Y03上模(下冲) TBJ_CS_OUT = 0; //Y10超声 TBJ_MOTOR_OUT = 0; //Y11拖带电机 TBJ_XM_VAVLE = 0; //Y12下模 TBJ_OneTimes = 0; //清除单次标志 TBJ_SetAlarmCode(0); if (TBJ_PARAM_SHENGJIAO == 1) TBJ_STOP_Step = 1; //停机节省布胶动作 else { TBJ_YD_VAVLE = 0; //Y05压带 TBJ_SJ_VAVLE = 0; //Y04送胶退回 } } if (TBJ_STOP_IN_UP ) { /*当自动步骤达到4,已完成送胶动作,将本次贴胶动作做完*/ TBJ_bSingleone=0;//单循环标志位 TBJ_bSingle=0; TBJ_bStart = 0; TBJ_bRunning = 0; TBJ_bAlarmStop = 0; TBJ_bStop = 0; TBJ_HMCS_Step = 0; TBJ_Auto_Step = 0; TBJ_SJ_FJ_Step = 0; TBJ_Motor_Step = 0; AxisEgmStop(X_AXIS); //刹停电机 SetEn(X_AXIS, TBJ_MOTOR_DISEN); //松轴 TBJ_GZ_VAVLE = 0; //Y01钩针 TBJ_FJ_VAVLE = 0; //Y02分胶 TBJ_SM_VAVLE = 0; //Y03上模(下冲) TBJ_CS_OUT = 0; //Y10超声 TBJ_MOTOR_OUT = 0; //Y11拖带电机 TBJ_XM_VAVLE = 0; //Y12下模 TBJ_OneTimes = 0; //清除单次标志 TBJ_SetAlarmCode(0); if (TBJ_PARAM_SHENGJIAO == 1) TBJ_STOP_Step = 1; //停机节省布胶动作 else { TBJ_YD_VAVLE = 0; //Y05压带 TBJ_SJ_VAVLE = 0; //Y04送胶退回 } } if (TBJ_bAlarmStop) { TBJ_bAlarmStop = 0; AxisEgmStop(X_AXIS); TBJ_Auto_Step = 0; TBJ_HMCS_Step = 0; TBJ_Motor_Step = 0; TBJ_SJ_FJ_Step = 0; TBJ_GZ_VAVLE = 0; //Y01钩针 TBJ_FJ_VAVLE = 0; //Y02分胶 TBJ_SM_VAVLE = 0; //Y03上模(下冲) TBJ_CS_OUT = 0; //Y10超声 TBJ_SJ_VAVLE=0; TBJ_YD_VAVLE=0; TBJ_XM_VAVLE = 0; //Y12下模 TBJ_bRunning = 0; SingOneFlg = 0; SetEn(X_AXIS, TBJ_MOTOR_DISEN); //松轴 } } void TBJ_STOP_Action(void) { switch (TBJ_STOP_Step) { case 0: break; case 1: { TBJ_YD_VAVLE = 1; TBJ_STOP_Delay = dwTickCount + 50; TBJ_STOP_Step = 2; } break; case 2: if (dwTickCount >= TBJ_STOP_Delay) { TBJ_SJ_VAVLE = 0; TBJ_STOP_Step = 3; } break; case 3: if (TBJ_SJ_ORIGIN_IN) { TBJ_YD_VAVLE = 0; TBJ_STOP_Step = 0; } break; } } //电机动作 void TBJ_Motor(void) // { switch (TBJ_Motor_Step) { case 0: //AxisDecStop(X_AXIS); //上钩针后减速停,保证拉链到位 break; case 1: TBJ_Motor_Step = 2; SetPos(X_AXIS, 0); if (TBJ_TEST_MODE) TBJ_TEST_TIME = dwTickCount + (unsigned long)500; TBJ_DJ_ErrorTime = dwTickCount + TBJ_PARAM_DJ_AUTO_STOP_TIME; //电机容错时间 if (TEST1 > 1 && TBJ_PARAM_DEC_MODE) { //第三条,开始走数控长度 AxisMovePosAccDecNotStop(X_AXIS, TBJ_PARAM_HIGH_SPEED, TBJ_SAVE_POS - TNJ_PARAM_TD_LENGTH - TBJ_PARAM_DEC_LEN, TBJ_PARAM_MOTOR_START_SPEED, TBJ_PARAM_NULL_SPEED, TBJ_PARAM_MOTOR_ADD, TBJ_PARAM_MOTOR_ADD + 10, 0); } else { AxisContinueMoveAcc(X_AXIS, TBJ_PARAM_HIGH_SPEED, TBJ_DIR_P, TBJ_PARAM_MOTOR_START_SPEED, TBJ_PARAM_NULL_SPEED, TBJ_PARAM_MOTOR_ADD, TBJ_PARAM_MOTOR_ADD); } break; case 2: if (TEST1 > 1 && TBJ_PARAM_DEC_MODE) { if (!TBJ_GUO_LIAN_IN) { TBJ_Motor_Step = 50; TBJ_Motor_Delay = dwTickCount + 10; //防震时间 if (TBJ_TEST_MODE) TBJ_TEST_TIME = dwTickCount + (unsigned long)200; else TBJ_TEST_TIME = dwTickCount + (unsigned long)5; TBJ_DJ_ErrorTime = dwTickCount + (unsigned long)ERRORTIME; } if ((TBJ_PARAM_LL_PRETECT_LENGTH > 0) && (GetPos(X_AXIS) >= TBJ_SAVE_POS + TBJ_PARAM_LL_PRETECT_LENGTH)) { TBJ_SetAlarmCode(8); //E8 拉链长度异常,超过拉链保护长度 } } else { if (TBJ_GUO_LIAN_IN_DOWN || (TBJ_TEST_MODE && (dwTickCount > TBJ_TEST_TIME))) { TBJ_Motor_Step = 50; TBJ_Motor_Delay = dwTickCount + 10; //防震时间 if (TBJ_TEST_MODE) TBJ_TEST_TIME = dwTickCount + (unsigned long)200; else TBJ_TEST_TIME = dwTickCount + (unsigned long)5; TBJ_DJ_ErrorTime = dwTickCount + (unsigned long)ERRORTIME; AxisChangeSpeed(X_AXIS, TBJ_PARAM_NULL_SPEED); } } if ((dwTickCount > TBJ_DJ_ErrorTime) && (TBJ_PARAM_DJ_AUTO_STOP_TIME != 0)) { TBJ_SetAlarmCode(24); //E24 拉拉链时间过长,可能由以下原因:①超出保护时间,请检查保护时间是否设置过短②电机是否启动,速度是否过慢③拉链过紧,电机没拉动 } break; case 50: //防震 if (TBJ_GUO_LIAN_IN) { TBJ_Motor_Step = 2; } if (dwTickCount >= TBJ_Motor_Delay) { TBJ_Motor_Step = 3; } break; case 3: if (TBJ_GUO_LIAN_IN_UP || (TBJ_TEST_MODE && (dwTickCount > TBJ_TEST_TIME))) //过链上升沿 { if (TBJ_PARAM_TWOTD_SELECT == 0) { TBJ_Motor_Step = 4; TBJ_DJ_ErrorTime = dwTickCount + 500; //电机容错时间 AxisMovePosAccDec(X_AXIS, TBJ_PARAM_NULL_SPEED, TNJ_PARAM_TD_LENGTH, TBJ_PARAM_NULL_SPEED, TBJ_PARAM_NULL_SPEED, 5, 5, 0); //普通拖带,根据脉冲走一定距离 TBJ_GZ_Delay = dwTickCount + TBJ_PARAM_GZ_DELAY; //钩针延时输出 } else { AxisMovePosAccDec(X_AXIS, TBJ_PARAM_NULL_SPEED, TBJ_PARAM_TWOTD_LENGTH, TBJ_PARAM_NULL_SPEED, TBJ_PARAM_NULL_SPEED, 5, 5, 0); //二次拖带,根据脉冲走不同距离 TBJ_Motor_Step = 40; } } else if (dwTickCount > TBJ_DJ_ErrorTime) //一直处于空位,没拉链警告 { TBJ_SetAlarmCode(1); //E01 没拉链警告 请检查 X11 过链接近开关 } break; case 40: if (!X_DRV) //轴停 { //TBJ_CLUTH_VAVLE = 0; //关离合 AxisEgmStop(X_AXIS); //停止电机,未松轴 TBJ_SJ_VAVLE=0; TBJ_GZ_VAVLE = 1; //输出钩针 if (TBJ_SJ_FJ_Step == 0) //分胶送胶已完成 { TBJ_Motor_Delay = dwTickCount + TBJ_PARAM_TWOTD_DELAY; //二次拖带电机延时输出 TBJ_Motor_Step = 41; } } break; case 41: if (dwTickCount > TBJ_Motor_Delay) //二次拖带电机延时已过 TBJ_Motor_Step = 4; TBJ_DJ_ErrorTime = dwTickCount + 500; //电机容错时间 AxisMovePosAccDec(X_AXIS, TBJ_PARAM_NULL_SPEED, TNJ_PARAM_TD_LENGTH, TBJ_PARAM_NULL_SPEED, TBJ_PARAM_NULL_SPEED, 5, 5, 0); //根据脉冲走一定距离 //TBJ_CLUTH_VAVLE = 1; //开离合 break; case 4: if (dwTickCount > TBJ_GZ_Delay) { TBJ_GZ_VAVLE = 1; //上钩针 } if (!X_DRV && (TBJ_PARAM_SGZSelect == 1) || (TBJ_TD_LIMIT_IN || TBJ_TEST_MODE)) { TBJ_GZ_VAVLE = 1; //上钩针 AxisEgmStop(X_AXIS); //急停电机 if (TBJ_PARAM_SGZSelect == 0) //选择双沟针方式 { TBJ_Motor_Step = 5; TBJ_Motor_Delay = dwTickCount + 1; //延时压带 } else { TBJ_Motor_Step = 0; //单钩针方式便完成电机动作 } } else if (dwTickCount >= TBJ_DJ_ErrorTime) { TBJ_SetAlarmCode(25); //E25 钩针未到位或 TBJ_TD_LIMIT_IN 钩针到位感应异常警告,电机停止 } break; /*以下为双钩针模式进行*/ case 5: if (dwTickCount > TBJ_Motor_Delay) { TBJ_Motor_Step = 6; TBJ_YD_VAVLE = 1; //压带输出 TBJ_PARAM_GZ_DELAY = dwTickCount + TBJ_PARAM_JJ_TIME; //压带输出延时退勾针 } break; case 6: if (dwTickCount > TBJ_PARAM_GZ_DELAY) //过了钩针延时 { TBJ_GZ_VAVLE = 0; //钩针退出 TBJ_Motor_Step = 7; ///SetEn(X_AXIS, TBJ_MOTOR_DISEN); //松轴 TBJ_DJ_ErrorTime = dwTickCount + ERRORTIME; //钩针退回容错时间 } break; case 7: if (TBJ_GZ_ORIGIN_IN) //钩针返回原位感应 { TBJ_Motor_Step = 0; //完成双钩针模式 } else if (dwTickCount > TBJ_DJ_ErrorTime) //钩针长时间不退回 { TBJ_SetAlarmCode(2); //E02 退勾针不到位或 TBJ_GZ_ORIGIN_IN 钩针复位感应异常,当前程序处于电机第七步 } break; //电机退链 case 20: //SetEn(X_AXIS, TBJ_MOTOR_EN); //锁轴 //SetPos(X_AXIS, 0); //设当前位置pos为0 TBJ_Motor_Step = 21; TBJ_Motor_Delay = dwTickCount + 10; //电机延时启动,等待锁轴 if (TBJ_PARAM_DJ_FANZHUAN == 0) //电机如果没有选择反转退链,则关闭该步骤 TBJ_Motor_Step = 0; break; case 21: if (dwTickCount > TBJ_Motor_Delay) //锁轴完成 { TBJ_Motor_Step = 22; AxisMovePosAccDec(X_AXIS, TBJ_PARAM_NULL_SPEED, -TBJ_TUILIAN_LENGTH, TBJ_PARAM_NULL_SPEED, TBJ_PARAM_NULL_SPEED, 5, 5, 0); //根据脉冲走一定距离 } break; case 22: if (!X_DRV) //电机移动到退链长度 { TBJ_Motor_Step = 0; if (TBJ_FJBACKMode) TBJ_FJ_VAVLE = 0; //二次拖带退分胶 } break; } } //自动运行动作 void TBJ_AutoRunStep(void) { if (TBJ_bRunning) { switch (TBJ_Auto_Step) { case 0: break; case 1: TBJ_Auto_Step = 2; SetEn(X_AXIS, TBJ_MOTOR_EN); //锁轴 TBJ_Auto_Delay = dwTickCount + 200; TEST1 = 0; //当前为第一条拉链 TBJ_SAVE_POS = 0; //用来保存第二条长度,置零 break; case 2: //第一条时 if (dwTickCount > TBJ_Auto_Delay) { TBJ_Auto_Step = 3; TBJ_SJ_FJ_Step = 1; //开始分胶送胶,送胶分胶需电机动作完成后才能完成 SetPos(X_AXIS, 0); if (!TBJ_GZ_VAVLE) { TBJ_Motor_Step = 1; //开始电机动作 } else { TBJ_SetAlarmCode(QD_GZOut_W); //E18 钩针阀未退回,无法启动 } } break; case 3: if ((TBJ_SJ_FJ_Step == 0) && (TBJ_Motor_Step == 0)) { TBJ_Auto_Step = 4; if (TEST1 == 1) //第二条拉链 TBJ_SAVE_POS = GetPos(X_AXIS); //保存第二条拉链的长度数据 if (TBJ_PARAM_DJ_FANZHUAN == 1) TBJ_Motor_Step = 20; TBJ_Auto_Delay = dwTickCount + 1000; //延迟执行超声合模动作 } break; case 4: if (((!TBJ_FJ_VAVLE && !TBJ_FJ_LIMIT_IN && TBJ_FJ_ORIGIN_IN) || TBJ_PARAM_FenJiaoSelect) //分胶没输出 到位没感应 原位有感应 没有分胶阀则不考虑前面条件 && ((!TBJ_SJ_VAVLE && !TBJ_SJ_LIMIT_IN && TBJ_SJ_ORIGIN_IN) || TBJ_PARAM_SongJiaoMode) //送胶没输出 到位没感应 原位有感应 滚轮送胶则不考虑前面条件 && ((!TBJ_PARAM_SGZSelect && TBJ_GZ_ORIGIN_IN && !TBJ_TD_LIMIT_IN) || TBJ_PARAM_SGZSelect)) //双钩针模式需要考虑钩针退回原位 拖带到位感应不亮 单钩针模式不考虑 { if (TBJ_Motor_Step == 0) //反转完成 { TBJ_Auto_Step = 5; TBJ_HMCS_Step = 1; //执行合模超声动作 } } else if (dwTickCount >= TBJ_Auto_Delay) { if (TBJ_FJ_VAVLE && !TBJ_PARAM_FenJiaoSelect) TBJ_SetAlarmCode(28); //E28 自动停止,分胶阀退位异常 else if (TBJ_FJ_LIMIT_IN && !TBJ_PARAM_FenJiaoSelect) TBJ_SetAlarmCode(29); //E29 自动停止,分胶未退位或分胶前感应异常 else if (!TBJ_FJ_ORIGIN_IN && !TBJ_PARAM_FenJiaoSelect) TBJ_SetAlarmCode(30); //E30 自动停止,分胶未退位或分胶后感应异常 else if (TBJ_SJ_VAVLE && !TBJ_PARAM_SongJiaoMode) TBJ_SetAlarmCode(31); //E31 自动停止,送胶阀退位异常 else if (TBJ_SJ_LIMIT_IN && !TBJ_PARAM_SongJiaoMode) TBJ_SetAlarmCode(32); //E32 自动停止,送胶未退位或送胶前感应异常 else if (!TBJ_SJ_ORIGIN_IN && !TBJ_PARAM_SongJiaoMode) TBJ_SetAlarmCode(33); //E33 自动停止,送胶未退位或送胶后感应异常 else { TBJ_SetAlarmCode(QD_GZDaoWei_W); //E03 钩针未退位或 X20 钩针到位感应异常警告,无法启动 } } break; case 5: if (TBJ_HMCS_Step == 0) { TBJ_Auto_Step = 6; TBJ_GZ_VAVLE = 0; //退钩针 if(TBJ_bSingleone==1) { SetEn(X_AXIS, TBJ_MOTOR_DISEN); //松轴 TBJ_bStop = 1; } if(!TBJ_bSingleone) { AddToTal(TBJ_TOTAL_ADDR); //产量增加 CalProSP(TBJ_SPEED_ADDR); //计算生产速度 } } break; case 6: if (!TBJ_SM_LIMIT_IN && //上模已离开 (((TBJ_PARAM_SGZSelect == 0) && TBJ_GZ_ORIGIN_IN && !TBJ_TD_LIMIT_IN) //双钩针模式,钩针已回到原位,拖带到位感应不亮(该感应需要上钩针配合,不亮代表无钩针配合) || ((TBJ_PARAM_XiaMo_Mode == 0) && !TBJ_GZ_ORIGIN_IN) //下模不动模式,钩针与上下模位置错开,不相互影响,不需要回到原位 || ((TBJ_PARAM_XiaMo_Mode == 1) && TBJ_PARAM_SGZSelect))) //下模活动模式,单钩针模式,钩针与上下模位置错开 { TBJ_Auto_Step = 7; TBJ_Auto_Delay = dwTickCount + TBJ_PARAM_KAIMO_TD_DELAY + 45; //开模后延时拖带,45为下限时间 } break; case 7: if (dwTickCount > TBJ_Auto_Delay) { TBJ_Auto_Step = 2; TEST1++; if (TEST1 > 2) TEST1 = 3; } break; } } } /*以下为 给力贴布机 2024.3.23 旧板设置默认参数*/ //void CSTieBu_SetDefault() //{ // unsigned char i = 0; // if(TBJ_Frist_SetDefa == 0) // { // user_datas[0] = 9; // user_datas[1] = 0; // user_datas[2] = 2; // user_datas[3] = 0; // user_datas[4] = 5; // user_datas[5] = 260; // user_datas[6] = 14; // user_datas[7] = 120; // user_datas[8] = 40; // user_datas[9] = 0; // user_datas[10] = 10; // user_datas[11] = 15; // user_datas[12] = 30; // user_datas[13] = 7; // user_datas[14] = 0; // user_datas[15] = 1; // user_datas[16] = 0; // user_datas[17] = 1; // user_datas[18] = 0; // user_datas[19] = 0; // user_datas[20] = 1; // user_datas[21] = 0; // user_datas[22] = 0; // user_datas[23] = 0; // user_datas[24] = 90; // user_datas[25] = 0; // user_datas[26] = 0; // user_datas[27] = 30; // user_datas[28] = 0; // user_datas[29] = 0; // user_datas[30] = 0; // user_datas[31] = 0; // user_datas[32] = 0; // user_datas[33] = 0; // user_datas[34] = 0; // user_datas[35] = 0; // user_datas[36] = 0; // user_datas[37] = 0; // user_datas[38] = 0; // user_datas[39] = 0; // user_datas[40] = 0; // user_datas[41] = 0; // user_datas[42] = 0; // user_datas[43] = 0; // user_datas[44] = 0; // user_datas[45] = 0; // user_datas[46] = 0; // user_datas[47] = 0; // user_datas[48] = 0; // user_datas[49] = 0; // user_datas[50] = 0; // user_datas[51] = 0; // user_datas[52] = 0; // user_datas[53] = 0; // user_datas[54] = 0; // user_datas[55] = 0; // user_datas[56] = 0; // user_datas[57] = 0; // user_datas[58] = 0; // user_datas[59] = 0; // user_datas[60] = 0; // user_datas[61] = 0; // user_datas[62] = 0; // user_datas[63] = 0; // user_datas[64] = 2; // user_datas[65] = 0; // user_datas[66] = 0; // user_datas[67] = 0; // while(i < 68) // { // Write24C04(2*i, cDataArea[i] >> 8); // Write24C04(2*i+1, cDataArea[i]); // i++; // } // Frist_SetDefa = 0x3E7; // Write24C04(2*95,cDataArea[71] >> 8); // Write24C04(2*95+1,cDataArea[71]); // } //} #endif