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_param_value] = ... 
%   mpc555_mtrctrl_calc_param(ideal_var_value, clock, clockvalid)
%
% This function returns a parameter value in clock ticks, given a time
% specified in seconds
%
% Inputs are:
%       'ideal_var_value':      The requested time value
%       'clock':                Clock frequency as appropriate
%       'clockvalid':           Whether the clock frequency is valid or not
function [new_param_value] = ...
    mpc555_mtrctrl_calc_param(ideal_var_value, clock, clockvalid)

% If the clock value is deemed to be relevant
if clockvalid
    % Calculate the actual period parameter for this value
    new_param_value = round(clock * ideal_var_value);
else
    % Otherwise return an empty value
    new_param_value = [];
end

end

Contact us