;假设系统的参数已经设好如下:
I119=0.015625 ;Max. Home/Jog Acceleration (counts / msec * msec)
I120=200 ;Home/Jog Acceleration time
I121=50 ;Home/Jog S-curve time
I123=32 ;Home Speed & Direction (counts / msec)
;****************************************************************
;C通道回零
I7012=1 ;Define capture event (1 = ‘C‘ channel)
I7013=0 ;Select Capture Flag (0 = ‘Home‘ flag)
I126=0 ;Define a Motor Home Offset
I5=2 ;I5 - Enable PLC‘s:
I119=0.015625 ;Max. Home/Jog Acceleration (counts / msec * msec)
I120=200 ;Home/Jog Acceleration time
I121=50 ;Home/Jog S-curve time
I123=32 ;Home Speed & Direction (counts / msec)
;****************************************************************
;C通道回零
I7012=1 ;Define capture event (1 = ‘C‘ channel)
I7013=0 ;Select Capture Flag (0 = ‘Home‘ flag)
I126=0 ;Define a Motor Home Offset
I5=2 ;I5 - Enable PLC‘s:
OPEN PLC 1 ;any number from 0 - 31, PLC 0 is recommended
CLEAR
Command"#1Home";Home motor #1
Disable PLC 1 ;Disable (terminate) PLC program
CLOSE ;Close PLC program buffer
;*****************************************************************
;C通道回零偏置
I126=4000 ;Define a Motor Home Offset (n = Offset * 16)
I7012=1 ;Define capture event (1 = ‘C‘ channel)
I7013=0 ;Select Capture Flag (0 = ‘Home‘ flag)
I5=2 ;I5 - Enable PLC‘s:
OPEN PLC 1 ;any number from 0 - 31, PLC 0 is recommended
CLEAR
Command"#1Home";Home motor #1
Disable PLC 1 ;Disable (terminate) PLC program
CLOSE ;Close PLC program buffer
;*****************************************************************
;C通道回零偏置
I126=4000 ;Define a Motor Home Offset (n = Offset * 16)
I7012=1 ;Define capture event (1 = ‘C‘ channel)
I7013=0 ;Select Capture Flag (0 = ‘Home‘ flag)
I5=2 ;I5 - Enable PLC‘s:
OPEN PLC 1 ;any number from 0 - 31, PLC 0 is recommended
CLEAR
Command"#1Home";Home motor #1
Disable PLC 1 ;Disable (terminate) PLC program
CLOSE ;Close PLC program buffer
;*****************************************************************
; 正限位通道回零
I126=0 ;Define a Motor Home Offset
I7012=2 ;Define capture event (2 = ‘n‘ flag - defined by I7mn3)
I7013=1 ;Select Capture Flag (1 = Limit +)
I124=$20001 ;Disable Limits
I128=160 ;Define the ‘In-Position‘ range (160 = ‘range‘ *
I5=2 ;Enable PLC‘s - background :
Command"#1Home";Home motor #1
Disable PLC 1 ;Disable (terminate) PLC program
CLOSE ;Close PLC program buffer
;*****************************************************************
; 正限位通道回零
I126=0 ;Define a Motor Home Offset
I7012=2 ;Define capture event (2 = ‘n‘ flag - defined by I7mn3)
I7013=1 ;Select Capture Flag (1 = Limit +)
I124=$20001 ;Disable Limits
I128=160 ;Define the ‘In-Position‘ range (160 = ‘range‘ *
I5=2 ;Enable PLC‘s - background :
M133->X:$0000B0,13,1 ; #1 Desired-velocity-zero bit
M140->Y:$0000C0,0,1 ; #1 In-position bit (background)
M145->Y:$0000C0,10,1 ; #1 Home-complete bit
OPEN PLC 1
CLEAR
M145=0 ;clear the #1 home-complete bit
Command"#1Home" ;Home motor #1
;Test for ‘Home Complete‘, ‘In-Position‘, ‘Desired-Velocity-Zero‘
While (M145=0) Or (M140=0) Or (M133=0)
End While
I124=$1 ;Enable Limits
Disable PLC 1 ;Disable (terminate) PLC program
CLOSE ;Close PLC program buffer
M140->Y:$0000C0,0,1 ; #1 In-position bit (background)
M145->Y:$0000C0,10,1 ; #1 Home-complete bit
OPEN PLC 1
CLEAR
M145=0 ;clear the #1 home-complete bit
Command"#1Home" ;Home motor #1
;Test for ‘Home Complete‘, ‘In-Position‘, ‘Desired-Velocity-Zero‘
While (M145=0) Or (M140=0) Or (M133=0)
End While
I124=$1 ;Enable Limits
Disable PLC 1 ;Disable (terminate) PLC program
CLOSE ;Close PLC program buffer
;*****************************************************************
; 正限位和C通道组合回零
I126=0 ;Define a Motor Home Offset
I7012=2 ;Define capture event (2 = ‘n‘ flag - defined by I7mn3)
I7013=1 ;Select Capture Flag (1 = Limit +)
I124=$20001 ;Disable Limits
I128=160 ;Define the ‘In-Position‘ range (160 = ‘range‘ *
I5=2 ;Enable PLC‘s - background :
M133->X:$0000B0,13,1 ; #1 Desired-velocity-zero bit
M140->Y:$0000C0,0,1 ; #1 In-position bit (background)
M145->Y:$0000C0,10,1 ; #1 Home-complete bit
OPEN PLC 1
CLEAR
M145=0 ;clear the #1 home-complete bit
;‘Limit +‘ home loop:
Command"#1Home" ;Home motor #1
;Test for ‘Home Complete‘, ‘In-Position‘, ‘Desired-Velocity-Zero‘
While (M145=0) Or (M140=0) Or (M133=0)
End While
;Change homing settings
I123=-32 ;Change Home Direction to negative
trunc函数是什么I7012=1 ;Define capture event (1 = ‘C‘ channel)
I7013=0 ;Select Capture Flag (1 = ‘Home‘ flag)
M145=0 ;clear the #1 home-complete bit
Command"#1Home" ;Home motor #1 using Index (C channel)
;‘C‘ home loop:
;
M145=0 ;clear the #1 home-complete bit
;‘Limit +‘ home loop:
Command"#1Home" ;Home motor #1
;Test for ‘Home Complete‘, ‘In-Position‘, ‘Desired-Velocity-Zero‘
While (M145=0) Or (M140=0) Or (M133=0)
End While
;Change homing settings
I123=-32 ;Change Home Direction to negative
trunc函数是什么I7012=1 ;Define capture event (1 = ‘C‘ channel)
I7013=0 ;Select Capture Flag (1 = ‘Home‘ flag)
M145=0 ;clear the #1 home-complete bit
Command"#1Home" ;Home motor #1 using Index (C channel)
;‘C‘ home loop:
;
‘Home Complete‘, ‘In-Position‘, ‘Desired-Velocity-Zero‘
While (M145=0) Or (M140=0) Or (M133=0)
End While
I124=$1 ;Enable Limits
Disable PLC 1 ;Disable (terminate) PLC program
CLOSE ;Close PLC program buffer
;*****************************************************************
; 跟随误差软件回零
I126=0 ;Define a Motor Home Offset
i197=3 ;Define a Motor Position capture & trigger mode
i112=16000 ;Define How much error to trigger home ,must less than ixx11
I5=2 ;I5 - Enable PLC‘s:
While (M145=0) Or (M140=0) Or (M133=0)
End While
I124=$1 ;Enable Limits
Disable PLC 1 ;Disable (terminate) PLC program
CLOSE ;Close PLC program buffer
;*****************************************************************
; 跟随误差软件回零
I126=0 ;Define a Motor Home Offset
i197=3 ;Define a Motor Position capture & trigger mode
i112=16000 ;Define How much error to trigger home ,must less than ixx11
I5=2 ;I5 - Enable PLC‘s:
OPEN PLC 1 ;any number from 0 - 31, PLC 0 is recommended
CLEAR
Command"#1Home";Home motor #1
Disable PLC 1 ;Disable (terminate) PLC program
CLOSE ;Close PLC program buffer
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论