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_dptram_wizard_preset(fngroup)
function str_fn_names = mpc555_dptram_wizard_preset(fngroup)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% FUNCTION MPC555_DPTRAM_WIZARD_PRESET(FNGROUP)
% 
% This provides the 16x3 cell array for certain combinations of DPTRAM
% functions to be used in the MPC555_DPTRAM_WIZARD_SET function
%
% FNGROUP:          The function group - valid groups are
%                       BLDC, BLDCm,
%                       DCm, DCm2, DCmDt, 3Sin3, svmStd3,
%                       DCm2Xor, DCmXor, DCmDtXor,
%                       3Sin3Xor, 3SinXor, 3SinDtXor,
%                       svmStd3Xor, svmStdXor, svmStdDtXor,
%                       3Sin, 3SinDt, svmStd, svmStdDt,
%
%
% Example:      str_fn_names = mpc555_dptram_wizard_preset('3Sin3');
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% Initialise list of function names
str_fn_names = {};
for fn_num=1:16
    for bank_num = 1:3
        str_fn_names{fn_num, bank_num} = '';
    end
end

switch fngroup
    case 'BLDC'
        uc_list = { 'BLDC_3HD' }; 
        uc_list = [uc_list; i_topbottom(fngroup)];
        uc_list = [uc_list; i_syncresfault(fngroup)];

    case 'BLDCm'
        uc_list = { 'BLDCm_3HD'; 'BLDCm' };
        uc_list = [uc_list; i_syncresfault(fngroup)];

    case {'DCm', 'DCm2', 'DCmDt', '3Sin3', 'svmStd3'}
        uc_list = { fngroup };
        uc_list = [uc_list; i_syncresfault(fngroup)];

    case {'DCm2Xor', 'DCmXor', 'DCmDtXor'}
        uc_list = i_ct(fngroup);
        uc_list = [uc_list; i_syncresfault(fngroup)];
        
    case {'3Sin3Xor', '3SinXor', '3SinDtXor', ...
            'svmStd3Xor', 'svmStdXor', 'svmStdDtXor'}
        uc_list = i_rt(fngroup);
        uc_list = [uc_list; i_syncresfault(fngroup)];

    case {'3Sin', '3SinDt', 'svmStd', 'svmStdDt'}
        uc_list = i_topbottom(fngroup);
        uc_list = [uc_list; i_syncresfault(fngroup)];
    
    otherwise
        error('Invalid function group')
        
end


str_fn_names(17-length(uc_list):16, 1) = uc_list;

end

function srf = i_syncresfault(prefix)

srf={};
srf{1,1} = [prefix, '_fault'];
srf{2,1} = [prefix, '_res'];
srf{3,1} = [prefix, '_sync'];

end

function tb = i_topbottom(prefix)

tb = {};
tb{1,1} = [prefix, '_top'];
tb{2,1} = [prefix, '_bottom'];
    
end

function rt = i_rt(prefix)

rt = {};
rt{1,1} = [prefix, '_R'];
rt{2,1} = [prefix, '_T'];
    
end

function ct = i_ct(prefix)

ct = {};
ct{1,1} = [prefix, '_C'];
ct{2,1} = [prefix, '_T'];
    
end

Contact us