The invention relates to a method for realizing a
CANopen slave
station, which is characterized in that: a hardware platform realized by the slave
station is a
PowerPC-based processor; a multi-thread
system is constructed on an eCos
operating system and comprises a
CANopen state
machine thread, a
timer thread and message reading interruption; the state
machine thread is used for managing
CANopen basic tasks such as switching the state of the slave
station, receiving CAN message, receiving and transmitting CAN messages, PDO messages and SDO messages,
processing the PDO, SDO, NMT and synchronous messages and the like; and an earliest deadline first (EDF) dynamic scheduling
algorithm is introduced into the synchronous PDO messages for transmitting real-
time data so as to ensure the requirement of low-priority messages on instantaneity and improve the communication characteristic of a
bus. The eCos embedded real-time
operating system is applied to the design of the slave station, so the instantaneity and concurrent
processing capacity are high; the dynamic scheduling
algorithm is introduced into the design of the synchronous PDO messages in the CANopen slave station, so the requirement of the low-priority messages on instantaneity is ensured; and an object dictionary meets the flexible configuration of a network, and objects in the object dictionary are changed according to the dynamic change of a
master station.