How can I perform a software or model triggerable hardware reset in xPC Target 3.4 (R2008a)?

1 view (last 30 days)
There does not currently seem to be a method for resetting the counters in software while a program is running on a target machine. I see there are options for resetting with an external signal, but it would be very useful if there was a Reset Counter Block that received a signal from the model (internal signal) and reset.
I would also like the option to reset the counter to a preset value, other than zero.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 27 Jun 2009
The ability for a software or model triggerable hardware reset is currently not available in xPC Target 3.4 (R2008a).
There are two possible workarounds that you can use:
Workaround 1: You could use a digital output that you connect to the index input on the board. Then, when you want to reset the counter, you assert, then de-assert the digital output. However, this may depend on the counter actively counting when you do that.
Workaround 2: You can latch the current value when an enable signal is true and subtract that value from the current value at all other times. A simple enabled subsystem with input connected to output and the output set to hold on disable would do this. Please refer to the attached example model which demonstrates this workaround. You can reset count by asserting the reset signal to enable the subsystem for one sample time. Even though the output of the encoder block does not go to zero, the count you use does go to zero. The example also includes a constant block (of value zero) that adds to the count value. The value of this constant block can be set to a value other than zero to reset the counter to this value.

More Answers (0)

Products


Release

R2008a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!