Forums

need AGC algoritm source code using DSK TMS320C6713

Started by Heni Rianti July 9, 2011
I need AGC algoritm source code using DSK TMS320C6713
like : :

"if ( signal_too_big() ) decrease_gain_quickly;
  else {
	if ( signal_below_threshold() and
	     gain_not_too_high_already() ) {
		increase_gain_slowly;
	}
  }"

I've been source code AGC with Matlab and it was implemented in CCS
(Code Composer Studio) but it still can't. CCS is software for my
board DSK TMS320C6713.

==source code Matlab==

Fs=8000;
t=0:1/Fs:0.1;
x1=sin(2*pi*200*t);
x2=4*sin(2*pi*200*t);
x3=2*sin(2*pi*200*t);
x4=0.5*sin(2*pi*200*t);
x=[x1 x2 x3 x4];
subplot(211);
plot(x)

error=0;
C=0;
n=0;
L=length(x);
R=1;
alpha=0.022;
D(1)=0;
y(1)=0;
for n=1:L;
        energi=y(n)*y(n);
        error=R-energi;
        C=alpha*error;
        D(n+1)=C+D(n);
        G=D(n);
        y(n+1)=G*x(n);
end
subplot(212);
plot(y)


so..please help me..
please reply my letter
thanks

regards
..heni..
On 07/08/2011 09:01 PM, Heni Rianti wrote:
> I need AGC algoritm source code using DSK TMS320C6713 > like : : > > "if ( signal_too_big() ) decrease_gain_quickly; > else { > if ( signal_below_threshold() and > gain_not_too_high_already() ) { > increase_gain_slowly; > } > }"
What's your skill set? You've got good looking pseudo code there -- what's keeping you from implementing it in C?
> I've been source code AGC with Matlab and it was implemented in CCS > (Code Composer Studio) but it still can't.
Eh? You mean you have source code _for_ AGC that you generated with Matlab, and it either won't compile under Code Composter or it doesn't work? That's the problem with these expert tools -- they only make the task easier if you're already an expert, and then the work of overcoming the tool's shortcomings is greater than the work of just doing the job yourself.
> CCS is software for my > board DSK TMS320C6713. > > ==source code Matlab== > > Fs=8000; > t=0:1/Fs:0.1; > x1=sin(2*pi*200*t); > x2=4*sin(2*pi*200*t); > x3=2*sin(2*pi*200*t); > x4=0.5*sin(2*pi*200*t); > x=[x1 x2 x3 x4]; > subplot(211); > plot(x) > > error=0; > C=0; > n=0; > L=length(x); > R=1; > alpha=0.022; > D(1)=0; > y(1)=0; > for n=1:L; > energi=y(n)*y(n); > error=R-energi; > C=alpha*error; > D(n+1)=C+D(n); > G=D(n); > y(n+1)=G*x(n); > end > subplot(212); > plot(y) > > > so..please help me.. > please reply my letter > thanks
Two easy steps: 1: Learn C. 2: Use it. -- Tim Wescott Wescott Design Services http://www.wescottdesign.com Do you need to implement control loops in software? "Applied Control Theory for Embedded Systems" was written for you. See details at http://www.wescottdesign.com/actfes/actfes.html