Moog Animatics SmartMotor™ Developer's Guide,Rev. L
Page 844 of 909
CAN Bus - Time Sync Follow Encoder
This program makes use of CANopen objects to provide following of a CANopen encoder on a
CANopen network. For the purposes of an example, one SmartMotor acts as a "master", and a
second SmartMotor can act as the encoder if a CANopen encoder is not available.
' Demo with one motors following a CANopen encoder on CANopen network.
' Motor 1 is a master as far as NMT and SDOs, but will follow data from
' encoder. Motor 2 will act as an encoder, (the PDO mapping to position actual
' instead of an encoder's position object.
' Load this program into both motors.
'++++ HEX Coded Objects for CAN +++++
#define x1000 4096 ' Object 1000h: Device Type
#define x1005 4101 ' Object 1005h: COB-ID Sync
#define x1006 4102 ' Object 1006h: Communication Cycle Period
#define x1400 5120 ' Object 1400h: Receive PDO Communication Parameter
#define x1600 5632 ' Object 1600h: Receive PDO Mapping Parameter 1
#define x1800 6144 ' Object 1800h: Transmit PDO communicating parameter 1
#define x1801 6145 ' Object 1801h: Transmit PDO communicating parameter 2
#define x1A00 6656 ' Object 1A00h: Transmit PDO Mapping Parameter 1
#define x1A01 6657 ' Object 1A01h: Transmit PDO Mapping Parameter 2
#define x2204 8708 ' Object 2204h: Mappable Variables aaa...ddd)
#define x2207 8711 ' Object 2207h: External encoder follow max value (where
' encoder rolls over) i.e., 10-bit encoder would be 1023
#define x2208 8712 ' Object 2208h: External encoder follow input value
#define x2209 8713 ' Object 2209h: External encoder follow control
#define x220A 8714 ' Object 220Ah: External encoder follow MFMUL
#define x220B 8715 ' Object 220Bh: External encoder follow MFDIV
#define x220C 8716 ' Object 220Ch: External encoder follow MFA
#define x220D 8717 ' Object 220Dh: External encoder follow MFD
#define x2304 8964 ' Object 2304h: Motor Status
#define x6002 24578 ' Object 6002h: (encoder profile) Total measuring range
#define x6040 24640 ' Object 6040h: Control word
#define x6060 24672 ' Object 6060h: Trajectory Mode
#define x6064 24676 ' Object 6064h: Position actual value (RPA)
#define x606C 24684 ' Object 606Ch: Velocity actual value (RVA)
#define x608F 24719 ' Object 608Fh: Position encoder resolution
#define x60F4 24820 ' Object 60F4h: Following Error actual value (REA)
' misc values:
#define xffffffff -1
OFF
ADDR=CADDR ' Set serial channel address so you don't have to re-
' address/detect motors.
ECHO ' Enable serial channel echo so you don't have to re-
' address/detect motors.
mmm=1 ' network master's address
fff=mmm ' following motor's address. In this demo, it is the network
Part 3: Examples: CAN Bus - Time Sync Follow Encoder