Search this site
Embedded Files
Skip to main content
Skip to navigation
RedD
RedD ...
My car ...
My bike ...
Fishing
Shop
Notebook
Measurements
HAM Radio
SSB demodulator
shack
r-137
6p3c
gu-43b 350
Gi-7bt
IC-718
Cat
Klopik tube lamp ...
Gu-46
Klopik
AVR SDR
Фазовращатель
SDR code
MixerS
Easy SDR
Easy SDR
Тема про SDR
Power Supply
Yagi w 2-4
QUISK
SDR теория
Demodulation Experiment
VSC&&arduino
AVR
DFT AVR
Led indicator AVR
Snake AVR
AVR Tetris Led
Cortex M3
Система команд
Учебный курс.
Shop AVR
Синтезатор
DUE
Распиновка по портам
ADC&DAC example
Example
Works ports
DUE Library
Atmel std & due programm
Работа с портами
Arduino DUE led blink
mp3
Timer
Timer НУЖНО ПРОБОВАТЬ
Driver ADC
fft
DUE libs
Stack
FreeDOS
Gimp
VirtualBox
SlackWare
ZX Spectrum
Octave
FFTW
OpenHPSDR-Power SDR
HardWare
ADC
Open SDR
OBS studio
twitch tv
Linux Mint
Комплексные числа
Orange Pi
ADC
C/C++
Tetris
sourse_current
sourse_Old
new
Bias RAM VGA
Snake algorithm
SDR
QT
Операторы
Audio
printf
Alsa record
DFT
dev/null
ASM
DSP
Customize Atmel Studio 7
SSB demodulator arduino DUE
DUE FFT
DUE VGA
RedD
SSB demodulator arduino DUE
{code}
#include <DueTimer.h>
#define Ntap 31
#define DCgain 32768
int myLed = 13;
int OutSample,I,Q,N,X1,X2,X3,Y1,Y2,Y3;
float count=0;
int led_flag=0;
int cos_N[4]={1,0,-1,0};
int sin_N[4]={0,1,0,-1};
int sin_N_m[4]={0,-1,0,1};
bool ledOn = false;
// Фильтр канала Q
int fir_Q(int NewSample) {
int FIRCoef[Ntap] = {
-406,
-207,
529,
240,
-698,
-274,
942,
308,
-1317,
-338,
1972,
363,
-3441,
-379,
10572,
17042,
10572,
-379,
-3441,
363,
1972,
-338,
-1317,
308,
942,
-274,
-698,
240,
529,
-207,
-406
};
static int x[Ntap]; //input samples
long int y=0; //output sample
int n;
//shift the old samples
for(n=Ntap-1; n>0; n--)
x[n] = x[n-1];
//Calculate the new output
x[0] = NewSample;
for(n=0; n<Ntap; n++)
y += FIRCoef[n] * x[n];
return y / DCgain;
}
// Фильтр канала I
int fir_I(int NewSample) {
int FIRCoef[Ntap] = {
-406,
-207,
529,
240,
-698,
-274,
942,
308,
-1317,
-338,
1972,
363,
-3441,
-379,
10572,
17042,
10572,
-379,
-3441,
363,
1972,
-338,
-1317,
308,
942,
-274,
-698,
240,
529,
-207,
-406
};
static int x[Ntap]; //input samples
long int y=0; //output sample
int n;
//shift the old samples
for(n=Ntap-1; n>0; n--)
x[n] = x[n-1];
//Calculate the new output
x[0] = NewSample;
for(n=0; n<Ntap; n++)
y += FIRCoef[n] * x[n];
return y / DCgain;
}
void myHandler(){ // обработчик прерывания по таймеру
if (N==3)
{
N=0;
}
else N++;
I=analogRead(A0);
Q=analogRead(A1);
X1=I*cos_N[N]+Q*sin_N[N];
X2=fir_I(X1);
X3=X2*cos_N[N];
Y1=I*sin_N_m[N]+Q*cos_N[N];
Y2=fir_Q(Y1);
Y3=Y2*sin_N_m[N];
OutSample=X3+Y3;
OutSample=OutSample+512;// восстанавливаем однополярный сигнал
analogWrite(DAC0, OutSample);
}
void setup(){
pinMode(myLed, OUTPUT);
Timer3.attachInterrupt(myHandler);
Timer3.start(1000000); // Calls every 50ms
pinMode(DAC0, OUTPUT);
pinMode(A0, INPUT);
pinMode(A1, INPUT);
}
void loop(){
while(1){
// I'm stuck in here! help me...
}
[/code]
Google Sites
Report abuse
Google Sites
Report abuse