text.skipToContent text.skipToNavigation

CANopen优点及参考例程

为什么选用CANopen?

  可支持多轴   CANopen最多支持控制127个轴,且通讯速率可高达1Mbps。   CANopen总线对数据通信数据块进行编码的方式,可以多主方式(Multi-master), 采用可靠的错误处理和检错机制,其协议包含了系统的,专业的工业用设备子协议,是专门为工业控制而发展的总线协议。符合工业控制所要求的高速,稳定可靠,高实时性要求。   布线简单   用传统脉冲方向或模拟量来驱动一个直角坐标机构至少需要连接4根线或者更多,CANopen方案布线简单,所有轴并联接入CAN_H和CAN_L信号即可。减少布线,更少出错,减少布线成本,人工成本,后期电缆老化或故障的维护成本,以及由于复杂的线路故障带来的不可估量的损失。   如下一些参考例程,供参考

位置表模式(Profile Position Mode)

  **** 电机使能 – CiA 402协议下 ****   $0603 $8 $2B $40 $60 $00 $06 $00 $00 $00 ‘Ready to Switch on   $0603 $8 $2B $40 $60 $00 $07 $00 $00 $00 ‘Switched on   $0603 $8 $2B $40 $60 $00 $0F $00 $00 $00 ‘Operation Enabled   **** 设置到位置表模式 ****   $0603 $8 $2F $60 $60 $00 $01 $00 $00 $00 ‘Set to Profile Position Mode   **** 设置运动参数 ****   $0603 $8 $23 $81 $60 $00 $F0 $00 $00 $00 ‘Set Profile Velocity to 1 rps   $0603 $8 $23 $83 $60 $00 $58 $02 $00 $00 ‘Set Acceleration to 100 rps/s   $0603 $8 $23 $84 $60 $00 $58 $02 $00 $00 ‘Set Deceleration to 100 rps/s   点对点绝对运动   $0603 $8 $23 $7A $60 $00 $40 $0D $03 $00 ‘Set Target Position to 200000 steps   $0603 $8 $2B $40 $60 $00 $1F $00 $00 $00 ‘Set New Set Point Bit to 1   $0603 $8 $2B $40 $60 $00 $0F $00 $00 $00 ‘Clear New Set Point Bit   点对点相对运动   $0603 $8 $23 $7A $60 $00 $40 $0D $03 $00 ‘Set Target Position to 200000 steps   $0603 $8 $2B $40 $60 $00 $5F $00 $00 $00 ‘Set New Set Point Bit to 1   $0603 $8 $2B $40 $60 $00 $4F $00 $00 $00 ‘Clear New Set Point Bit   多点运动,点与点间有停止动作   $0603 $8 $23 $81 $60 $00 $B0 $04 $00 $00 ‘Set Profile Velocity to 5 rps   $0603 $8 $23 $7A $60 $00 $40 $0D $03 $00 ‘Set Target Position to 200000 steps   $0603 $8 $2B $40 $60 $00 $5F $00 $00 $00 ‘Set New Set Point Bit to 1   $0603 $8 $2B $40 $60 $00 $4F $00 $00 $00 ‘Clear New Set Point Bit   $0603 $8 $23 $81 $60 $00 $60 $09 $00 $00 ‘Set Profile Velocity to 10 rps   $0603 $8 $23 $7A $60 $00 $40 $0D $03 $00 ‘Set Target Position to 600000 steps   $0603 $8 $2B $40 $60 $00 $5F $00 $00 $00 ‘Set New Set Point Bit to 1   $0603 $8 $2B $40 $60 $00 $4F $00 $00 $00 ‘Clear New Set Point Bit   多点运动,持续动作   $0603 $8 $23 $81 $60 $00 $B0 $04 $00 $00 ‘Set Profile Velocity to 5 rps   $0603 $8 $23 $7A $60 $00 $40 $0D $03 $00 ‘Set Target Position to 200000 steps   $0603 $8 $2B $40 $60 $00 $5F $02 $00 $00 ‘Set New Set Point Bit to 1   $0603 $8 $2B $40 $60 $00 $4F $02 $00 $00 ‘Clear New Set Point Bit   $0603 $8 $23 $81 $60 $00 $60 $09 $00 $00 ‘Set Profile Velocity to 10 rps   $0603 $8 $23 $7A $60 $00 $40 $0D $03 $00 ‘Set Target Position to 600000 steps   $0603 $8 $2B $40 $60 $00 $5F $02 $00 $00 ‘Set New Set Point Bit to 1   $0603 $8 $2B $40 $60 $00 $4F $02 $00 $00 ‘Clear New Set Point Bit   多点运动,动作间有条件变化   $0603 $8 $23 $81 $60 $00 $B0 $04 $00 $00 ‘Set Profile Velocity to 5 rps   $0603 $8 $23 $7A $60 $00 $40 $0D $03 $00 ‘Set Target Position to 200000 steps   $0603 $8 $2B $40 $60 $00 $7F $02 $00 $00 ‘Set New Set Point Bit to 1   $0603 $8 $2B $40 $60 $00 $6F $02 $00 $00 ‘Clear New Set Point Bit   $0603 $8 $23 $81 $60 $00 $60 $09 $00 $00 ‘Set Profile Velocity to 10 rps   $0603 $8 $23 $7A $60 $00 $40 $0D $03 $00 ‘Set Target Position to 600000 steps   $0603 $8 $2B $40 $60 $00 $7F $02 $00 $00 ‘Set New Set Point Bit to 1   $0603 $8 $2B $40 $60 $00 $6F $02 $00 $00 ‘Clear New Set Point Bit

速度表模式(Profile Velocity Mode)

  **** 电机使能 – CiA 402协议下 ****   $0603 $8 $2B $40 $60 $00 $06 $00 $00 $00 ‘Ready to Switch on   $0603 $8 $2B $40 $60 $00 $07 $00 $00 $00 ‘Switched on   $0603 $8 $2B $40 $60 $00 $0F $01 $00 $00 ‘Operation Enabled; Motion Halted   **** 设置到速度表模式 ****   $0603 $8 $2F $60 $60 $00 $03 $00 $00 $00 ‘Set to Profile Velocity Mode   **** 设置运动参数 ****   $0603 $8 $23 $FF $60 $00 $F0 $00 $00 $00 ‘Set Target Velocity to 1 rps   $0603 $8 $23 $83 $60 $00 $58 $02 $00 $00 ‘Set Acceleration to 100 rps/s   $0603 $8 $23 $84 $60 $00 $58 $02 $00 $00 ‘Set Deceleration to 100 rps/s   **** 开始/停止 动作 ****   $0603 $8 $2B $40 $60 $00 $0F $00 $00 $00 ‘Motion Starts   $0603 $8 $23 $FF $60 $00 $60 $09 $00 $00 ‘Change Target Velocity to 10 rps   $0603 $8 $2B $40 $60 $00 $0F $01 $00 $00 ‘Motion Halts

回原点模式(Homing Mode)

  **** 电机使能 – CiA 402协议下 ****   $0603 $8 $2B $40 $60 $00 $06 $00 $00 $00 ‘Ready to Switch on   $0603 $8 $2B $40 $60 $00 $07 $00 $00 $00 ‘Switched on   $0603 $8 $2B $40 $60 $00 $0F $00 $00 $00 ‘Operation Enabled   **** 设置到回原点模式 ****   $0603 $8 $2F $60 $60 $00 $06 $00 $00 $00 ‘Set to Homing Mode   $0603 $8 $2F $98 $60 $00 $13 $00 $00 $00 ‘Set Homing Method to 19   **** 设置运动参数 ****   $0603 $8 $23 $9A $60 $00 $58 $02 $00 $00 ‘Set Homing Acceleration to 100rps/s   $0603 $8 $23 $99 $60 $01 $F0 $00 $00 $00 ‘Set Homing Velocity (Search for Switch) to 1rps   $0603 $8 $23 $99 $60 $02 $78 $00 $00 $00 ‘Set Index Velocity (Search for Index or Zero) to 0.5rps   $0603 $8 $23 $7C $60 $00 $40 $9C $00 $00 ‘Set Homing Offset to 40000 Steps   $0603 $8 $2F $01 $70 $00 $03 $00 $00 $00 ‘Set Homing Switch to Input 3   **** 开始/停止 回原点 ****   $0603 $8 $2B $40 $60 $00 $1F $00 $00 $00 ‘Homing Starts   $0603 $8 $2B $40 $60 $00 $1F $01 $00 $00 ‘Homing Stops

通用Q程序(Normal Q Mode)

  **** 电机使能 – CiA 402协议下 ****   $0603 $8 $2B $40 $60 $00 $06 $00 $00 $00 ‘Ready to Switch on   $0603 $8 $2B $40 $60 $00 $07 $00 $00 $00 ‘Switched on   $0603 $8 $2B $40 $60 $00 $0F $00 $00 $00 ‘Operation Enabled   **** 设置到Q编程 ****   $0603 $8 $2F $60 $60 $00 $FF $00 $00 $00 ‘Set to Normal Q Mode   $0603 $8 $2F $07 $70 $00 $01 $00 $00 $00 ‘Set Q Segment Number to 1   **** 开始/停止 Q编程 ****   $0603 $8 $2B $40 $60 $00 $1F $00 $00 $00 ‘Q Program Starts   $0603 $8 $2B $40 $60 $00 $1F $01 $00 $00 ‘Q Program Halts

同步Q程序(Sync Q Mode)

  **** 电机使能 – CiA 402协议下 ****   $0603 $8 $2B $40 $60 $00 $06 $00 $00 $00 ‘Ready to Switch on   $0603 $8 $2B $40 $60 $00 $07 $00 $00 $00 ‘Switched on   $0603 $8 $2B $40 $60 $00 $0F $00 $00 $00 ‘Operation Enabled   **** 设置到同步Q程序 ****   $0603 $8 $2F $60 $60 $00 $FE $00 $00 $00 ‘Set to Sync Q Mode   $0603 $8 $2F $07 $70 $00 $01 $00 $00 $00 ‘Set Q Segment Number to 1   $0603 $8 $23 $05 $10 $00 $80 $00 $00 $00 ‘Set Sync Pulse to 0x80   **** 开始/停止 Q编程 ****   $80 $0 ‘Q Program Starts   $0603 $8 $2B $40 $60 $00 $0F $01 $00 $00 ‘Q Program Halts

PDO映射(PDO Mapping)

  **** 映射TPDO2 ****   $0000 $2 $80 $03 ‘Return back to “PreOperation” Mode   $0603 $8 $23 $01 $18 $01 $80 $02 $00 $80 ‘Turn off the TPDO2   $0603 $8 $2F $01 $1A $00 $00 $00 $00 $00 ‘Set Number of Mapped objects to zero   $0603 $8 $23 $01 $1A $01 $10 $00 $41 $61 ‘Map object1(0x6041) to TPDO2 subindex1.   $0603 $8 $23 $01 $1A $02 $20 $00 $0A $70 ‘Map object2(0x700A) to TPDO2 subindex2.   $0603 $8 $2F $01 $1A $00 $02 $00 $00 $00 ‘Set Number of total Mapped objects to Two   $0603 $8 $23 $01 $18 $01 $80 $02 $00 $00 ‘Turn on the TPDO2