Moog Animatics SmartMotor™ Developer's Guide,Rev. L
Page 292 of 909
EXAMPLE: (For CANopen only, using firmware 5.x.4.21 or later) Read status word 10, bits 1-
5, and then clear the event flag.
WHILE 1
IF B(10,1)==1
Z(10,1) ' Clear event flag
PRINT("Rx PDO 1",#13)
ENDIF
IF B(10,2)==1
Z(10,2) ' Clear event flag
PRINT("Rx PDO 2",#13)
. . .
ENDIF
IF B(10,5)==1
Z(10,5) ' Clear event flag
PRINT("Rx PDO 5",#13)
ENDIF
LOOP
END
EXAMPLE: Read Status Words for faults, and print fault messages to the screen. You can use
the tables in Status Words on page 879 to get the bits and meanings, or you can use the "bit"
commands (like Ba, Be, etc.) where available.
IF(B(0,0)!=1) 'Read Status Word 0, bit 0 for Drive Enable fault
' This section looks at low voltage and drive enable input state,
' which can prevent drive ready state regardless of any faults.
Z(6,13) WAIT=10 ' Clear drive voltage low flag to check true state
IF B(6,13) == 1 ' Not a fault but will prevent drive ready
PRINT("Bus voltage is too low.",#13)
ENDIF
IF (FW/(2^24)) == 6
' For Class 6 motors:
IF IN(7) == 0
PRINT("Drive enable input low",#13)
ENDIF
IF Ba==1 ' Look for overcurrent fault
PRINT("Overcurrent occurred",#13)
ENDIF
ELSEIF (FW/(2^24)) == 5
' For Class 5 Class 5 M-series 5.98.x.x or 5.97.x.x
' NOTE:Not a fault in D-series
IF (((FW/65536)&255) == 98)|(((FW/65536)&255) == 97)
IF IN(12) == 0
PRINT("Drive enable input low",#13)
ENDIF
IF Ba==1 ' Look for overcurrent fault
PRINT("Overcurrent occurred",#13)
ENDIF
Part 2: Commands: B(word,bit)