gusucode.com > vnt工具箱matlab源码程序 > vnt/vntblks/vntmasks/private/privatevntsfcnfindconfig.m

    function [configBlock params] = privatevntsfcnfindconfig(parent, objConstructor)
%PRIVATEVNTSFCNFINDCONFIG Finds the config block returns the parameters. 
%
%    [CONFIGBLOCK PARAMS] = PRIVATEVNTSFCNFINDCONFIG(PARENT, OBJCONSTRUCTOR)
%    Finds the underlying configuration block and returns the parameters
%    associated with the block
%    PARAMS structure include: BusSpeed, SJW, TSEG1, TSEG2, NumSamples and
%    AcknowledgeMode. 

%    SS 04-01-08
%    Copyright 2008-2011 The MathWorks, Inc.

params = [];

if strcmpi(objConstructor, 'Select a constructor')
    configBlock = -1;
    return;
end

configBlock = find_system(parent, 'LookUnderMasks', 'all', ...
                                  'FollowLinks', 'on', ...
                                  'MaskType', 'CAN Configuration', ...
                                  'ObjConstructor', objConstructor);

if (isempty(configBlock) || length(configBlock)>1 )
    return;
end

% Get the parameters.
params.BusSpeed = str2double( get_param(configBlock{1}, 'BusSpeed') );
params.SJW      = str2double( get_param(configBlock{1}, 'SJW') );
params.TSEG1    = str2double( get_param(configBlock{1}, 'TSEG1') );
params.TSEG2    = str2double( get_param(configBlock{1}, 'TSEG2') );
params.NSamples = str2double( get_param(configBlock{1}, 'NSamples') );
ackMode  = get_param(configBlock{1}, 'AckMode');
if strcmpi(ackMode, 'Normal')
    params.SilentMode = 0;
else % Silent
    params.SilentMode = 1;
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%