At the MATLAB command prompt type plcdemo_fixed_point
. Once the
example model opens , follow these instructions to configure the model for Structured Text
code generation.
If the block in the subsystem has a Signal Attributes tab, navigate to that tab and jump to step 3.
If there are no blocks in the subsystem with a Signal Attributes tab use the Data Type Conversion block. Add the Data Type Conversionblock to the model and continue to the next step.
For the Integer rounding mode parameter, select
Round
.
Clear the Saturate on integer overflow check box.
For the Output data type parameter, select a fixed-point data type.
Click the Data Type Assistant button .
For the Word length parameter, enter 8
, 16
, or
32
.
For the Mode parameter, select Fixed
point
.
For the Scaling parameter, select Binary
point
.
Click OK.
In the Model Configuration Parameters dialog box, click the Hardware
Implementation
node.
For the Device vendor parameter, select
Generic
or Custom Processor
. If
you select Custom Processor
proceed to step 4.
For the Device type, select Custom
.
For the Signed integer division rounds to, select
Zero
.
For the Number of bits, set char to
16
.
64 bit fixed-point data type not supported.
The data type and value type must match for fixed-point tunable parameters of type
Simulink.Parameter
.
Scaling parameter type Slope and
bias
is not supported for code generation.
You are now ready to: