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_invert_macrodata(macrodata, macro_filename)
function macronumbers = mpc555_mtrctrl_invert_macrodata(macrodata, macro_filename)

macro_replacement = mpc555_dptram_macro_parameters();

%% Work out if this is a macro file that requires configuration
macrofilenumber = 0;
for current_entry = 1:length(macro_replacement)
    [macropath, macroname] = fileparts(macro_filename);
    if strcmpi(macro_replacement(current_entry).Filename, macroname)
        macrofilenumber = current_entry;
    end
end

% Return if this is not a supported macro file
if macrofilenumber == 0
    macro_replacement = [];
    return;
end

% Now build up the selection of values
macropos = 1;
% Take a copy of the number of modifiable parameters
numparams = length(macro_replacement(macrofilenumber).Parameter);
trackercounter = 1;

macronumbers = [];
for param_num = 1:numparams
    % First use the standard name
    if ~strcmp(macro_replacement(macrofilenumber).Parameter(param_num).Name, '');
        macronumbers(macropos) = hex2dec(macrodata{trackercounter, 2}(3));
        trackercounter = trackercounter+1;
        macropos = macropos+1;
        if ~strcmp(macro_replacement(macrofilenumber).Parameter(param_num).Name0, '')
            trackercounter = trackercounter + 1;
        end
    elseif ~strcmp(macro_replacement(macrofilenumber).Parameter(param_num).Name0, '');
        macronumbers(macropos) = hex2dec(macrodata{trackercounter, 2}(3));
        trackercounter = trackercounter + 1;
        macropos = macropos+1;
    end
end

end

Contact us