Real-Time Workshop | ![]() ![]() |
External Mode Related Menu and Toolbar Items
To communicate with a target program, the model must be operating in external mode. The Simulation menu and the toolbar provide two ways to enable external mode:
Once external mode is enabled, you can use the Simulation menu or the toolbar to connect to and control the target program.
Note You can enable external mode, and simultaneously connect to the target system, by using the External Mode Control Panel. See External Mode Control Panel. |
Simulation Menu
When Simulink is in external mode, the upper section of the Simulation menu contains external mode options. Initially, Simulink is disconnected from the target program, and the menu displays the options shown in this picture.
Figure 6-1: Simulation Menu External Mode Options
(Host Disconnected from Target)
The Connect to target option establishes communication with the target program. When a connection is established, the target program may be executing model code, or it may be awaiting a command from the host to start executing model code.
If the target program is executing model code, the Simulation menu contents change, as shown in this picture.
Figure 6-2: Simulation Menu External Mode Options
(Target Executing Model Code)
The Disconnect from target option disconnects Simulink from the target program, which continues to run. The Stop real-time code option terminates execution of the target program and disconnects Simulink from the target system.
If the target program is in a wait state, the Start real-time code option is enabled, as shown in this picture. The Start real-time code option instructs the target program to begin executing the model code.
Figure 6-3: Simulation Menu External Mode Options
(Target Awaiting Start Command)
Toolbar Controls
The Simulink toolbar controls, shown in Figure 6-4, let you control the same external mode functions as the Simulation menu. Simulink displays external mode icons to the left of the Simulation mode menu. Initially, the toolbar displays a Connect to target icon and a disabled Start real-time code button (shown in Figure 6-4). Click on the Connect to target icon to connect Simulink to the target program.
Figure 6-4: External Mode Toolbar Controls (Host Disconnected from Target)
When a connection is established, the target program may be executing model code, or it may be awaiting a command from the host to start executing model code.
If the target program is executing model code, the toolbar displays a Stop real-time code button and a Disconnect from target icon (shown in Figure 6-5). Click on the Stop real-time code button to command the target program to stop executing model code and disconnect Simulink from the target system. Click on the Disconnect from target icon to disconnect Simulink from the target program while leaving the target program running.
Figure 6-5: External Mode Toolbar Controls (Target Executing Model Code)
If the target program is in a wait state, the toolbar displays a Start real-time code button and a Disconnect from target icon (shown in Figure 6-6). Click on the Start real-time code button to instruct the target program to start executing model code. Click on the Disconnect from target icon to disconnect Simulink from the target program.
Figure 6-6: External Mode Toolbar Controls (Target in Wait State)
![]() | Using the External Mode User Interface | External Mode Control Panel | ![]() |