Delta Tau GEO BRICK LV User Manual

Page of 271
Geo Brick LV User Manual
 
PinOuts and Software Setup 
 50 
Encoder Loss Example PLC: 
A 4-axis Geo Brick is setup to kill all motors upon the detection of one or more encoder loss. In addition, 
it does not allow enabling any of the motors when an encoder loss condition has been encountered: 
#define Mtr1AmpEna 
 
M139 
; Motor#1 Amplifier Enable Status Bit 
Mtr1AmpEna->X:$B0,19   
 
; Suggested M-Variable 
#define Mtr2AmpEna 
 
M239 
; Motor#2 Amplifier Enable Status Bit 
Mtr2AmpEna->X:$130,19   
 
; Suggested M-Variable 
#define Mtr3AmpEna 
 
M339 
; Motor#3 Amplifier Enable Status Bit 
Mtr3AmpEna->X:$1B0,19   
 
; Suggested M-Variable 
#define Mtr4AmpEna 
 
M439 
; Motor#4 Amplifier Enable Status Bit 
Mtr4AmpEna->X:$230,19   
 
; Suggested M-Variable 
 
#define Mtr1EncLoss 
 
M180 
; Motor#1 Encoder Loss Status Bit 
Mtr1EncLoss->Y:$078807,0,1 
 
;   
#define Mtr2EncLoss 
 
M280 
; Motor#2 Encoder Loss Status Bit 
Mtr2EncLoss->Y:$078807,1,1 
 
;   
#define Mtr3EncLoss 
 
M380 
; Motor#3 Encoder Loss Status Bit 
Mtr3EncLoss->Y:$078807,2,1 
 
;   
#define Mtr4EncLoss 
 
M480 
; Motor#4 Encoder Loss Status Bit 
Mtr4EncLoss->Y:$078807,3,1 
 
;   
 
#define SysEncLoss 
 
P1080  ; System Global Encoder Loss Status (user defined)  
SysEncLoss=0 
 
 
 
; Save and Set to 0 at download, normal operation 
 
 
 
 
 
; =1 System Encoder Loss Occurred 
 
OPEN PLC 1 CLEAR 
If (SysEncLoss=0) 
; No Loss yet, normal mode 
 If (Mtr1EncLoss=0 or Mtr2EncLoss=0 or Mtr4EncLoss=0 or Mtr4EncLoss=0) 
  CMD^K  
 
; One or more Encoder Loss(es) detected, kill all motors 
  SysEncLoss=1  
; Set Global Encoder Loss Status to Fault 
 EndIf 
EndIF 
 
If (SysEncLoss=1) 
; Global Encoder Loss Status At Fault? 
 If (Mtr1AmpEna=1 or Mtr2AmpEna=1 or Mtr4AmpEna=1 or Mtr4AmpEna=1) ; Trying to Enable Motors? 
  CMD^K  
 
; Do not allow Enabling Motors, Kill all  
 EndIF 
EndIF 
CLOSE