xPC Target | ![]() ![]() |
Controlling the Target Application
As mentioned, there is no way to interact with the running target application in polling mode. This is especially restricting for the case of stopping the model execution before the application has reached the stop time that was defined before the execution started. Because polling mode tries to be as optimal as possible, any rapid-prototyping feature except signal logging is disabled. But because I/O driver blocks added to the model are fully functional, you can use I/O drivers to get to a minimal level of interactivity.
Stopping a target application using polling mode -- You can use a low-latency digital input driver for the digital PCI board in your model, which reads in a single digital TTL signal. The signal is TTL low unless the model execution should be stopped, for which the signal changes to TTL high. The output port of the digital input driver block can be connected to the input port of a Stop simulation block, found in the standard Simulink block library. This stops the target application's execution, depending on the state of the digital input signal. You can either use a hardware switch connected to the board-specific input pin or you can generate the signal by other means. For example, you could use another digital I/O board in the host machine and connect the two boards (one in the host, the other in the target) over a couple of wires. You could then use MathWorks Data Acquisition Toolbox to drive the corresponding TTL output pin of the host board to stop the target application execution from within MATLAB.
Generally the same software/hardware setup can be used for passing other information back and forth during run time of the target application. It is important to understand that any additional feature beside signal logging has to be implemented at the model level, and it is therefore the user's responsibility to optimize for the minimal additional latency the feature introduces. For example, being able to interactively stop the target application execution has to be paid for by the introduction of an additional 1 us latency necessary to read the digital signal over the digital I/O board. But perhaps you need to read digital inputs from the plant hardware anyway and not all lines are used. In this case you get the feature for free.
![]() | Restrictions Introduced by the Polling Mode | Polling Mode Performance | ![]() |