c_home_14.pmc

来自「基于PMAC运动控制卡的八轴数控磨床PLC运动控制程序」· PMC 代码 · 共 97 行

PMC
97
字号

/*File Name   : Xx_linea.plc

Description : Phasing PLC Program for Motor #1
NOTICE:  This PLC program should only be used AFTER PMAC2 has been
powered up AND AFTER YOUR AMPLIFIERS have are powered up.
Not observing this precaution could result in damage to
your motors and/or amplifiers!  It is recommended that you
run this PLC program upon confirmed request from the user.

******************************************************************/

;I5 = 0    //; this is a precaution so that this PLC does not run instantly after reset
#include "address.h"
#include "oem.h"		;//@Add
#include "tsodick1.h"
#include "tsodick2.h"
#include "tsodick3.h"
//M988->X:$78100,20,4      ; UVW position register
//M989->X:$130,0,24,S    ; phase position register
//;M960->Y:$0814,10,1      ; home
//;M961->X:$003D,13,1    ; move zero
DELETE GATHER
DELETE TRACE

OPEN PLC 14 CLEAR

//home sequence
//RESTORE_HM_OFF_P = I126
i7112=11
If (PULSES_PER_UNIT_1 < 0)
  i522=-100
Else
  i522=100
EndIf
I51 = 0

// for release from home dog 2000.04.04
If (HOME_FLAG_5 = 0)
  If (I523 < 0)
    cmd"#5 j^10000000000"
  Else
    cmd"#5 j^-10000000000"
  EndIf
  While (HOME_FLAG_5 = 0)
  EndWhile
  cmd"#5 j/"
  //waiting time
  TIME_WAIT_CNT_P=2
  While (TIME_WAIT_CNT_P > 0)
    TIME_WAIT_CNT_P=TIME_WAIT_CNT_P-1
  EndWhile
  While ((MOTOR5_STATUS_M&MOTOR_IN_POS_BIT) = 0) //;MOTOR1_STATUS_M(M730) INPOSITION BIT
EndWhile
EndIf

cmd"#5 hm"

//waiting time
TIME_WAIT_CNT_P=2
While (TIME_WAIT_CNT_P > 0)
  TIME_WAIT_CNT_P=TIME_WAIT_CNT_P-1
EndWhile

While ((MOTOR5_STATUS_M&$400) = 0) //;MOTOR1_STATUS_M(M730)->Y:$814,0,24,U INPOSITION BIT
EndWhile

//waiting time
TIME_WAIT_CNT_P=5
While (TIME_WAIT_CNT_P > 0)
  TIME_WAIT_CNT_P=TIME_WAIT_CNT_P-1
EndWhile

While ((MOTOR5_STATUS_M&$1) = 0) //;MOTOR1_STATUS_M(M730)->Y:$814,0,24,U INPOSITION BIT
EndWhile



I51 = 1
@SET_OFF(CS_STATUS4_M,CS_HOME_INIT)
@SET_OFF(CS_STATUS4_M,CS_HOME_INPROGRESS)
DISABLE PLC 14
CLOSE













⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?