CONmtGetMode

Description

This function returns the current CANopen NMT state machine mode.

Prototype

CO_MODE CONmtGetMode(CO_NMT *nmt);

ParameterDescription
nmtreference to NMT structure

Returned Value

>0     The current NMT mode

=0     An error is detected

Additional Information

The following table shows the possible values of the type CO.MODE:

ValueDescription
CO_INVALIDDevice in INVALID mode, e.g. not initialized
CO_INITDevice in INIT mode
CO_PREOPDevice in PRE-OPERATIONAL mode
CO_OPERATIONALDevice in OPERATIONAL mode
CO_STOPDevice in STOP mode

Example

The following example shows how to perform operations only in operational mode of the CANopen node AppNode:


    CO_MODE mode;
    :
    mode = CONmtGetMode (&(AppNode.Nmt));
    if (mode == CO_OPERATIONAL) {
        /* perform actions in operational mode */
    }
    :