Code covered by the BSD License  

Highlights from
MPC555 Motor Control Function Blockset

MPC555 Motor Control Function Blockset

by

 

20 Mar 2006 (Updated )

Additional I/O blocks for MPC555 target - specifically targetting TPU functionality

mpc555_mtrctrl_calc_mask_range(block, ...
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% function new_value = mpc555_mtrctrl_calc_mask_range(block, ...
%    input_param, output_param, ...
%    input_min, input_max, ...
%    output_min, output_max, ...
%    output_type)
%
% This function scales and offsets an input value from one range to
% another and then casts the output to the required type.
%
function mpc555_mtrctrl_calc_mask_range(block, ...
    input_param, output_param, ...
    input_min, input_max, ...
    output_min, output_max, ...
    output_type)

% Get the input value from the mask
input_value = str2num(get_param(block, input_param));

% Calculate the scaled value
new_value = mpc555_mtrctrl_calc_range(input_value, ...
    input_min, input_max, ...
    output_min, output_max, ...
    output_type);

% Set the output value back to the mask
set_param(block, output_param, num2str(new_value));

end

Contact us