Please enable JavaScript to view this site.

Function that returns the NMT operating mode of the EtherCAT line indicated.

Syntax

i32 ecat_get_state (i32 nEth)

nEth

EtherCAT line number

Result

Returns:

Value

Description

1

INIT

2

PREOPERATIONAL

4

SAFEOPERATIONAL

8

OPERATIONAL

-1

Illegal EtherCAT Line Index

-2

Ethernet port not configured EtherCAT

Validity

Rule, Task

Note


hmtoggle_plus0Examples

Example of use:

....

; Restart the Ethercat line  on ETH 2

; force the line to INIT STATE

result = ecat_set_state(2, 1)      ; set line 2 in init

if (result < 0)

    alarm_set(UNABLE_TO_SET_ECAT, 0, 1)

    return

endif

mt_wait(ecat_get_state(2) = 1 )    ; wait for line in init state

; ok now restart

result = ecat_set_state(2, 8)      ; set line 2 in operational

if (result < 0)

    alarm_set(UNABLE_TO_SET_ECAT, 0, 2)

    return

endif

mt_wait(ecat_get_state(2) = 8 )    ; wait for line in operational state

...

NOTE: This example can only be used in the task, as the mt_wait() instruction is used.

 

  

Keyboard Navigation

F7 for caret browsing
Hold ALT and press letter

This Info: ALT+q
Page Header: ALT+h
Topic Header: ALT+t
Topic Body: ALT+b
Contents: ALT+c
Search: ALT+s
Exit Menu/Up: ESC