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

...
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% function [new_actual_value] = ...
%    mpc555_mtrctrl_calc_actual(param_var_value, clock, clockvalid)
%
%   Calculate the value of a time in seconds given a parameter in clock
%   ticks.
%
%   Parameters are:
%       'param_var_value':      The parameter value in clock ticks
%       'clock':                The clock frequency
%       'clockvalid':           Logical true/false value specifying if the
%                               clock frequency is relevant in this
%                               situation
%
% Example:
%        [new_actual_value] = ...
%    mpc555_mtrctrl_calc_actual(param_var_value, clock, clockvalid)

function [new_actual_value] = ...
    mpc555_mtrctrl_calc_actual(param_var_value, clock, clockvalid)

% If the clock signal that has been given IS valid
if clockvalid
    % Calculate the actual period parameter for this value
    new_actual_value = (param_var_value/clock);
else
    % Otherwise return a null value
    new_actual_value = [];
end

end

Contact us