Main Content


Perform external mode background activity



errorCode = extmodeBackgroundRun(); performs external mode background activity, for example, retrieving packets from the network, running the packets protocol layer, and sending packets to the development computer.

Do not invoke the function in a thread with real-time constraints.

Use this function with other external mode functions to enable communication between Simulink® and the target application during an external mode simulation.


Set Up External Mode Communication

For a pseudo-code example that shows how you can provide external mode communication by using the function with related functions, see External Mode Abstraction Layer.

Output Arguments

collapse all

Error code, returned as an extmodeErrorCode_T enumeration with one of these values:

  • EXTMODE_SUCCESS (0) –– No error detected.

  • EXTMODE_BUSY (-6) –– Resource busy detected, try later

  • EXTMODE_INV_MSG_FORMAT (-7) –– Invalid message format detected by external mode communication protocol.

  • EXTMODE_INV_SIZE (-8) –– Invalid size detected by the external mode communication protocol.

  • EXTMODE_NOT_INITIALIZED (-9) –– External mode not initialized yet.

  • EXTMODE_NO_MEMORY (-10) –– No memory available on the target hardware.

  • EXTMODE_ERROR (-12) –– External mode generic error detected.

  • EXTMODE_PKT_CHECKSUM_ERROR (-13) –– Checksum inconsistency detected by external mode communication protocol.

  • EXTMODE_PKT_RX_TIMEOUT_ERROR (-14) –– Timeout error detected during the reception of a packet.

  • EXTMODE_PKT_TX_TIMEOUT_ERROR (-15) –– Timeout error detected during the transmission of a packet.

Version History

Introduced in R2018a