[etherlab-dev] ethercat generic block, SDO configuration problems (solved)
Inselmini Paolo
Paolo.Inselmini at ch.gfac.com
Fri Oct 16 15:58:53 CEST 2009
SDO configuration parameters same to not correctly be evaluated by the Generic Slave (simulink ethercat block).
Only the first row of the SDO configuration matrix will be correctly configured.
I found a solution to this problem by modifing the Generic Slave mask (initialization script) to:
.... some code...
SdoConfig = [];
if isempty(sdo_config)
SdoConfig = [];
elseif isnumeric(sdo_config) && size(sdo_config,2) == 4
SdoConfig = cell2struct(...
num2cell(sdo_config),...
{'Index' 'SubIndex' 'BitLen' 'Value'}, 2);
elseif isstruct(sdo_config)
SdoConfig = sdo_config;
else
errordlg([gcb ':Value Sdo Config must be a numeric M-by-4 '...
'matrix [Index SubIndex BitLen Value] '...
'or a structure vector with the fields '...
'''Index'', ''SubIndex'', ''BitLen'' and ''Value''']);
end
.... some code...
the original code was:
.... some code...
SdoConfig = [];
if isempty(sdo_config)
SdoConfig = [];
elseif isnumeric(sdo_config) && size(sdo_config,2) == 4
SdoConfig = struct(...
'Index', sdo_config(:,1), ...
'SubIndex', sdo_config(:,2), ...
'BitLen', sdo_config(:,3),...
'Value', sdo_config(:,4));
elseif isstruct(sdo_config)
SdoConfig = sdo_config;
else
errordlg([gcb ':Value Sdo Config must be a numeric M-by-4 '...
'matrix [Index SubIndex BitLen Value] '...
'or a structure vector with the fields '...
'''Index'', ''SubIndex'', ''BitLen'' and ''Value''']);
end
.... some code...
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.etherlab.org/pipermail/etherlab-dev/attachments/20091016/0effeb7e/attachment-0002.htm>
More information about the Etherlab-dev
mailing list