Application note

Executing an MCode program over EtherNet/IP

Home > Resources > Application notes > Executing an MCode program over EtherNet/IP


There are instances where it may be desirable to execute and MCode script over EtherNet/IP. This application note explains the process.


  • Lexium MDrive



Allowing resident MCode program scripts to function in protocol EtherNet/IP with Lexium MDrive Ethernet devices that include TCP/IP application version and up, is now available.

Lexium MDrive Ethernet TCP/IP Configuration Utility contains an “E.I.P.” tab with a frame in the lower left-hand corner labeled “I/O Implicit connection test”. Two Boolean entities are described as follows on their function regarding the enabling of resident program operation with EIP.

To allow resident MCode program scripts to run:

  1. Turn off I/O implicit writes.
    • If ‘Halt Motion’ is ON, an ‘EX 1’ will be issued on every valid EIP implicit I/O connection and an ‘Esc’ will be issued on an I/O connection lost.
    • If ‘Halt Motion’ is OFF, then no ‘EX 1’ or ‘Esc’ commands are issued allowing an ‘SU’ label to be used in an MCode script.
  2. Observe the following closely in your MCode script to be executed via EIP:
    • Always use “H 1000” on the first line following all “SU” labels or methods residing @ address “1”.
    • Do not use or save any “PR”, “L” or “EM” mnemonics in resident programs or saved parameter statements.The following additions have been added to the explicit EIP class 0x64
  3. The following additions have been added to the explicit EIP class 0x64:
    Access Class Instance Attrib Data type Mnemonic
    WO 0x64 0x01 0x06 MDRV_STRING EX
    RO 0x64 0x01 0x07 MDRV_BIT BY
    RW  0x64 0x01 0x08 MDRV_I32 V1
    RW 0x64 0x01 0x09 MDRV_I32 V2
    RW 0x64 0x01 0x0A MDRV_I32 V3
    RW 0x64 0x01 0x0B MDRV_I32 V4
    RW  0x64 0x01 0x0C MDRV_I32 V5
    RW 0x64 0x01  0x0D  DRV_I32 V6
    RW 0x64 0x01  0x0E MDRV_I32  V7
    RW 0x64 0x01 0x0F MDRV_I32 V8

    Note variables V1 through V8 need to be defined as user variables in order to be utilized.

Resource files

When it comes to your form, fit and function requirements, don’t settle. Get precisely what you need working with us. We know motion.

Contact us with any questions about how we can help you with your motion application or for assistance with your SEM products.

Browse our resource section and find the most useful tools and documents for all our products.