![background image](http://html1.mh-extra.com/html/omron/smartslice-grt1-ml2/smartslice-grt1-ml2_programming-manual_742305318.webp)
Examples and tips
PROGRAMMING MANUAL
312
R
e
vi
si
o
n
1
.0
res_ant=res_act
res_act=READ_BIT(2,signal_state)
res_bit=res_act AND NOT res_ant
RETURN
'--------------------------------------------------------
alarm_sequence:
'Alarm notification
IF SYSTEM_ERROR=0 AND MOTION_ERROR=0 AND READ_BIT(15,diag01)=1
THEN
alarm_bit=0
ELSE
IF MOTION_ERROR<>0 THEN
SET_BIT(0,status_bits) 'Motion error flag
first_error=ERROR_AXIS
ENDIF
alarm_bit=1
ENDIF
'MECHATROLINK axis alarm monitoring
FOR i=0 TO max_axis
BASE(i)
VR(servoi*2)=AXISSTATUS
'if stopped by alarm, notify the alarm code
IF ATYPE>=40 AND ATYPE<=42 THEN
IF status_word=2 THEN
'if no response, notify "communication alarm"
IF (AXISSTATUS AND 4)<>0 THEN
VR(servi*2)=$E6
ELSEIF NOT DRIVE_ALARM(servi*2) THEN
VR(servi*2)=$E6
ELSEIF VR(servi*2)=0 THEN
VR(servi*2)=$bb
ENDIF