hi guys,
it's me again. i am working on a student bachelor thesis where i should implement a BTC from matlab to the SHARC ADSP-21369 EZ-Kit to edit parameters for a simple 3-band-EQ during the board's runtime.
i have now a class in matlab including the methods for accessing, writing and reading the BTC and i have initialized the channels in VisualDSP++ like shown in the getting started example.
now i have the following problem:
i will transmit filter coefficients für a biquad filter, so the numerator-coefficients are 3x1 cell array, the denominator-coeffs 2x1 cell array
if i try to send these values through the BTC, the BTC memory window shows me, that only one single coefficient of the array is edited, the others get 0. a very interesting point is, that in the 3x1 cell array the 2nd coefficient is edited, the first and the third get zero.
has anyone an idea how to fix this? i would need quite a quick solution, because i have to presentate my project on monday.
i will post my matlab function code in here, because i am not sure if everyone is able to open the .m-file, i hope this is ok.
thanks a lot and best regards,
markus
----------------------------------------------- HERE STARTS THE CODE ---------------------------------------------------------
accesBTC.m
classdef accessBTC < handle
properties
numChannels = [];
isInitialized = 0; %Logical 0 or 1 to indicate if the class is instantiated to connect to the VisualDSP session
end
properties(SetAccess = private)
channelList = {}; % Array of channel objects
end
methods
function initialize(obj)
a = actxserver('VisualDSP.ADspApplication');
btcPlugin = a.PluginList.invoke('Item','BtcManager');
btcManager = btcPlugin.Open;
btcChannelList = btcManager.ChannelList(int16(0)); % Get the channel list in processor #0 (always INT16)
obj.numChannels = btcChannelList.Count;
disp(['Total Number of Channels: ', num2str(obj.numChannels)]);
% Create the BTC Channel interfaces
for i = 1: obj.numChannels
obj.channelList{i} = btcChannelList.invoke('Item',int32(i-1));
end
obj.isInitialized = 1;
% S=saveobj(obj);
end % End of Method: INITIALIZE
function outVal = read(obj,channelNum,width)
% Default width is 32; other possible values: 16, 8
% Channel num starts frm 0
if nargin ==2
width = 32;
end
widthStr = ['btcWidth',num2str(width)];
btcChan = obj.channelList{channelNum};
out_val = btcChan.Read(widthStr);
outVal = cell2mat(out_val);
end % End of Method: READ
function write(obj, channelNum, val)
% input val needs to be a scalar or a vector of int32 or in16 or
% int8 values
% Channel num starts frm 0
if nargin ~=3
error('WRITE method for accessBTC object needs 2 inputs.')
end
btcChan = obj.channelList{channelNum+1};
btcChan.Write('btcWidth32',num2cell(val));
end %End of Method: WRITE
function reset(obj)
obj.numChannels = [];
obj.isInitialized = 0;
obj.channelList = [];
end %End of Method: RESET
end
and my calling function is like this:
btc.write(0,num_1);
btc.write(1,den_1);
where num_1 & den_1 are single (32bit) row-vectors...