PISO-CPM100(U) / PCM-CPM100 user manual (ver. 2.02) Dec/03/2012 ----------------- 56
4.5.22. CPM100_NMTGuarding
Description:
Use the function CPM100_NMTGuarding to set guard time and life
time factor of the slave with the specified node ID. Then, the master will
automatically send the guarding message to slave device according to
the “GuardTime” parameters of this function. If the master doesn’t
receive the confirmation of guarding message from the salve, the
CPM100 will produce a Node_Guarding_Event event to users. Users
may use the function CPM100_InstallNMTErrISR to install a
user-defined process to get the guarding fail event and process the
guarding fail procedure. However, if the slave doesn’t receive the
guarding message during the Node Life time period (Node Life time =
“GuardTime” * “LifeTime”), it will be triggered to send the EMCY
message. It is recommended that “LifeTime” value is set to more than 1.
Take a note that following the CANopen specification, it is not allowed
for one slave device to use both error control mechanisms Guarding
Protocol and Heartbeat Protocol at the same time.
Syntax:
WORD
CPM100_NMGuarding(
BYTE
BoardNo,
BYTE
Node,
WORD
GuardTime,
BYTE
LifeTime,
BYTE
BlockMode)
Parameter:
BoardNo:
[input] CPM100 board number (0~7).
Node:
[input] Slave device Node-ID (1~127).
GuardTime:
[input] Guard Time (1 ~ 65535 ms).
LifeTime:
[input] Life Time Factor (1 ~ 255).
BlockMode:
[input] 0 means this function is non-block-function, and 1
means this function is block-function. If set this parameter to 1, the
running procedure of the users’ application will be held in the
function until return. If set to 0, this function will return “CPM_
Processing” directly. This function will return its process status
while users apply it with the same “BoardNo” and “Node” again. If
the procedure is still not complete, it will return “CPM_Wait”.