User`s guide
15 Frequently Asked Questions
• If the blocks of interest have special ch aracters, retrieve the mangled name
with
tg.showsignals='on' or tg.showpar am = 'on'.
For example, if carriage return
'\n' is part of the block path, the mangled
name returns with carriage returns replaced by spaces.
How Do I Handle Register Rollover for xPC Tar get
Encoder Blocks?
Encoder boards have a fixed size counter register of 16 bits, 24 b its, or 32 bits.
Regardless of th e size, the register always eventually overflow s and r olls over.
This can happen in either the positive or negative direction.
Some boards provide a hardware mech anism to account for overflows or
rollovers. As a best practice, you should design your model to always deal
with overflows or rollovers. An initial count can handle the issue for some
applications.
To handle register rollovers, you can use standard Simulink blocks to design
the following counter algorithm types:
• Rollover Counter — Count the number of rollovers
• Extended Counter — Provide an extended counter that is not limited by
register size
The Incremental Encoder sublibrary of the xPC Target library contains
example blocks for these two ty pes of counters. See Rollover Counter and
Extended Counter for further details. You can use these blocks in your model
as is, or m odified for your model. Connect the output of the encoder block
to these blocks.
These counters perform the following. To view the algorithms used in these
implementations, right-click the subsystem and select the Look Under
Mask option.
• A rollover counter counts the number of tim es the output of an encoder
block has ro lled over. It counts up for positive direction rollovers and down
for negative direction rollovers.
15-34