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_tpu_sm_remote_callback(block, system)
function mpc555_mtrctrl_tpu_sm_remote_callback(block, system)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% MPC555_MTRCTRL_TPU_SM_REMOTE_CALLBACK(BLOCK, SYSTEM)
%
% Updates channel and module information in the TPU SM Remote block
% when attached to a new TSM or SM block
%
% Example:
%       mpc555_mtrctrl_tpu_sm_remote_callback(gcb, gcs);


realblocks = find_system((system), 'ReferenceBlock', ...
        'mpc555_mtrctrl/TPU3 Stepper Motor');
realblocks = [realblocks, ...
        find_system((system), 'ReferenceBlock', ...
        'mpc555_mtrctrl/TPU3 Table Stepper Motor')];

if length(realblocks) ~= 0 && ~strcmp(get_param(block, 'linkto'), '<empty>')
   set_param(block, 'channel', get_param( get_param(block, 'linkto'), 'channel'));
   set_param(block, 'module', get_param( get_param(block, 'linkto'), 'module'));
   
   switch( get_param( get_param(block, 'linkto'), 'referenceblock') )
       case 'mpc555_mtrctrl/TPU3 Stepper Motor'
           set_param(block, 'smortsm', 'SM');
       case 'mpc555_mtrctrl/TPU3 Table Stepper Motor'
           set_param(block, 'smortsm', 'TSM');
   end
end

set_param(block, 'userdata', get_param(block, 'linkto'));
set_param(block, 'userdatapersistent', 'on');

end

Contact us