forked from acco/chti23
fin de la DFT / pb de format
This commit is contained in:
parent
b6baee8edc
commit
99785ea3ac
6 changed files with 2359 additions and 2034 deletions
173
signal/matlab/ScriptDFT.m
Normal file
173
signal/matlab/ScriptDFT.m
Normal file
|
@ -0,0 +1,173 @@
|
|||
%%
|
||||
%TUTO BAC A SABLE
|
||||
figure(1);
|
||||
plot(Res.Sinus_Continu);
|
||||
hold on;
|
||||
plot(Res.Sinus_Echanti,'o');
|
||||
grid;
|
||||
title('Courbe temporelle du Sinus');
|
||||
|
||||
tab = linspace(0,M-1,M);
|
||||
tab = tab*(Fe/M);
|
||||
r = fft(Res.Sinus_Echanti.data);
|
||||
|
||||
figure(2);
|
||||
stem(tab,abs(r/M));
|
||||
grid;
|
||||
title('Module de la TFD en fonction de la fréquence');
|
||||
|
||||
|
||||
%%
|
||||
%QUESTION 1 ET 2
|
||||
clear all;
|
||||
close all;
|
||||
clc;
|
||||
|
||||
Fe = 320000;
|
||||
Te = 1/Fe;
|
||||
T = 1/5000;
|
||||
M = T/Te;
|
||||
Tsim = T-Te;
|
||||
|
||||
F1 = 85000;
|
||||
F2 = 90000;
|
||||
F3 = 95000;
|
||||
F4 = 100000;
|
||||
F5 = 115000;
|
||||
F6 = 120000;
|
||||
|
||||
Res = sim('SimuGuns');
|
||||
echelle_freq = linspace(0,M-1,M)*(Fe/M);
|
||||
r = fft(Res.Echanti.data);
|
||||
|
||||
figure(1);
|
||||
plot(Res.Continu);
|
||||
grid;
|
||||
|
||||
figure(2);
|
||||
plot(echelle_freq,abs(r/M),'o');
|
||||
grid;
|
||||
%%
|
||||
%QUESTION 3
|
||||
clear all;
|
||||
close all;
|
||||
clc;
|
||||
|
||||
Fe = 320000;
|
||||
Te = 1/Fe;
|
||||
T = 1/5000;
|
||||
M = T/Te;
|
||||
Tsim = T-Te;
|
||||
|
||||
F1 = 85005.9;
|
||||
F2 = 90000;
|
||||
F3 = 94846.8;
|
||||
F4 = 100000;
|
||||
F5 = 115015.9;
|
||||
F6 = 120000;
|
||||
|
||||
Res = sim('SimuGuns');
|
||||
echelle_freq = linspace(0,M-1,M)*(Fe/M);
|
||||
r = fft(Res.Echanti.data);
|
||||
|
||||
figure(1);
|
||||
plot(Res.Continu);
|
||||
grid;
|
||||
|
||||
hold on;
|
||||
figure(2);
|
||||
|
||||
semilogy(echelle_freq,abs(r/M));
|
||||
grid;
|
||||
|
||||
%%
|
||||
%Question 4
|
||||
clear all;
|
||||
close all;
|
||||
clc;
|
||||
|
||||
Fe = 320000;
|
||||
Te = 1/Fe;
|
||||
T = 1/5000;
|
||||
M = T/Te;
|
||||
Tsim = T-Te;
|
||||
|
||||
F1 = 85005.9;
|
||||
F2 = 90000;
|
||||
F3 = 94846.8;
|
||||
F4 = 100000;
|
||||
F5 = 115015.9;
|
||||
F6 = 120000;
|
||||
|
||||
Res = sim('SimuGuns');
|
||||
for i = 1:32
|
||||
Res.Echanti.data(i) = 0;
|
||||
end
|
||||
echelle_freq = linspace(0,M-1,M)*(Fe/M);
|
||||
r = fft(Res.Echanti.data);
|
||||
|
||||
figure(1);
|
||||
plot(Res.Continu);
|
||||
grid;
|
||||
|
||||
hold on;
|
||||
figure(2);
|
||||
semilogy(echelle_freq,abs(r/M));
|
||||
grid;
|
||||
|
||||
%%
|
||||
%Question 6
|
||||
clear all;
|
||||
close all;
|
||||
clc;
|
||||
F1 = 85000;
|
||||
Fe = 320000;
|
||||
Te = 1/Fe;
|
||||
%T = 1/F1;
|
||||
%M = T/Te;
|
||||
T = 2*10^(-4);
|
||||
M=2^6;
|
||||
Tsim = T-Te;
|
||||
|
||||
Res = sim('SimuGuns');
|
||||
echelle_freq = linspace(0,M-1,M)*(Fe/M);
|
||||
r = fft(Res.carre1.data);
|
||||
|
||||
figure(1);
|
||||
plot(Res.carre1);
|
||||
grid;
|
||||
|
||||
hold on;
|
||||
figure(2);
|
||||
plot(echelle_freq,log10(abs(r/M)),'o');
|
||||
grid;
|
||||
%%
|
||||
% Question 8
|
||||
clear all;
|
||||
close all;
|
||||
clc;
|
||||
F1 = 85000;
|
||||
Fe = 320000;
|
||||
Te = 1/Fe;
|
||||
%T = 1/F1;
|
||||
%M = T/Te;
|
||||
T = 2*10^(-4);
|
||||
M=2^6;
|
||||
Tsim = T-Te;
|
||||
p = tf('p');
|
||||
Fp = 1/(1.7483e-23*p^4 + 7.6663e-18*p^3 + 1.162e-11*p^2 + 3.0332e-6*p+1);
|
||||
|
||||
Res = sim('SimuGuns');
|
||||
echelle_freq = linspace(0,M-1,M)*(Fe/M);
|
||||
r = fft(Res.carre.data);
|
||||
|
||||
figure(1);
|
||||
plot(Res.carre);
|
||||
grid;
|
||||
|
||||
hold on;
|
||||
figure(2);
|
||||
bode(Fp);
|
||||
plot(bode(Fp));
|
||||
%plot(echelle_freq,log10(abs(r/M)),'o');
|
||||
grid;
|
|
@ -1,5 +1,7 @@
|
|||
PRESERVE8
|
||||
THUMB
|
||||
;;IMPORT LeSignal
|
||||
EXPORT DFT_ModuleAuCaree
|
||||
|
||||
|
||||
; ====================== zone de réservation de données, ======================================
|
||||
|
@ -22,6 +24,45 @@ Index DCD 0
|
|||
area moncode,code,readonly
|
||||
; écrire le code ici
|
||||
|
||||
DFT_ModuleAuCaree
|
||||
;;R0 et R1 sont utilises pour les arg
|
||||
push{r4,r5,r6,r7,r8,r9}
|
||||
mov r5,#0 ;;registre qui va contenir la somme des cos
|
||||
mov r8,#0 ;;registre qui va contenir la somme des sin
|
||||
mov r9,#0 ;;index pour signal64echanti et les tabs
|
||||
mov r2,#0
|
||||
reel
|
||||
cmp r9,#63
|
||||
bgt DFT_ModuleAuCarreFin
|
||||
;;On lit la valeur de l'argument signal64ech
|
||||
;;et on le multiplie à chaque valeur du tabCos
|
||||
ldrsh r3,[r0,r9,lsl #1] ;;on recup le signal64echanti
|
||||
|
||||
|
||||
ldr r4, =TabCos ;;on recup la neme valeur du tableau de cos
|
||||
ldrsh r6, [r4,r2,lsl #1] ;;on stocke la valeur cos a la neme position
|
||||
mul r4,r6,r3 ;; on fait xn*cos
|
||||
|
||||
add r5,r5,r4 ;;et on l'ajoute à la somme des cosinus
|
||||
|
||||
imag
|
||||
ldr r7, =TabSin
|
||||
ldrsh r8,[r7,r2,lsl #1]
|
||||
mul r7,r8,r3
|
||||
add r8,r8,r7 ;;sommre des sin
|
||||
|
||||
add r9,#1
|
||||
add r2,r1
|
||||
b reel
|
||||
|
||||
DFT_ModuleAuCarreFin
|
||||
|
||||
mul r5,r5
|
||||
mul r8,r8
|
||||
add r0,r5,r8
|
||||
pop{r4,r5,r6,r7,r8,r9}
|
||||
bx lr
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -30,16 +71,6 @@ Index DCD 0
|
|||
AREA Trigo, DATA, READONLY
|
||||
; codage fractionnaire 1.15
|
||||
|
||||
DFT_ModuleAuCaree proc
|
||||
push{r2,r3,r4,r5,r6,r7,r8,r9}
|
||||
ldr r3,=TabCos
|
||||
ldr r2,=M
|
||||
ldr r2,[r2]
|
||||
ldr r7,=Index
|
||||
ldr r4,[r7]
|
||||
|
||||
etape1
|
||||
ldrsh r5 ,[r3
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
|
||||
|
||||
#include <stdio.h>
|
||||
#include "DriverJeuLaser.h"
|
||||
|
||||
|
||||
extern int DFT_ModuleAuCaree(short int * signal , char k );
|
||||
extern short int LeSignal;
|
||||
|
||||
int main(void)
|
||||
{
|
||||
|
@ -13,13 +13,13 @@ int main(void)
|
|||
|
||||
// Après exécution : le coeur CPU est clocké à 72MHz ainsi que tous les timers
|
||||
CLOCK_Configure();
|
||||
|
||||
// K1 (85) = 34
|
||||
// K2 (90) = 36
|
||||
// K3 (95) = 38
|
||||
// K4 (100) = 40
|
||||
// K5 (115) = 46
|
||||
// K6 (120) = 48
|
||||
int Res_DFT[32];
|
||||
char K1 = 17;
|
||||
// K2 (90) = 18
|
||||
// K3 (95) = 19
|
||||
// K4 (100) = 20
|
||||
// K5 (115) = 23
|
||||
// K6 (120) = 24
|
||||
|
||||
|
||||
|
||||
|
@ -27,7 +27,9 @@ CLOCK_Configure();
|
|||
|
||||
//============================================================================
|
||||
|
||||
|
||||
for (int k = 0; k<32;k++){
|
||||
Res_DFT[k] = DFT_ModuleAuCaree(&LeSignal,k);
|
||||
}
|
||||
while (1)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -75,7 +75,7 @@
|
|||
<OPTFL>
|
||||
<tvExp>1</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<IsCurrentTarget>0</IsCurrentTarget>
|
||||
<IsCurrentTarget>1</IsCurrentTarget>
|
||||
</OPTFL>
|
||||
<CpuCode>18</CpuCode>
|
||||
<DebugOpt>
|
||||
|
@ -153,7 +153,72 @@
|
|||
<Name>-U066CFF574857847167074929 -O2254 -S0 -C0 -A0 -N00("ARM CoreSight SW-DP") -D00(1BA01477) -L00(0) -TO18 -TC10000000 -TP21 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO7 -FD20000000 -FC800 -FN1 -FF0STM32F10x_128.FLM -FS08000000 -FL020000 -FP0($$Device:STM32F103RB$Flash\STM32F10x_128.FLM)</Name>
|
||||
</SetRegEntry>
|
||||
</TargetDriverDllRegistry>
|
||||
<Breakpoint/>
|
||||
<Breakpoint>
|
||||
<Bp>
|
||||
<Number>0</Number>
|
||||
<Type>0</Type>
|
||||
<LineNumber>62</LineNumber>
|
||||
<EnabledFlag>1</EnabledFlag>
|
||||
<Address>134218472</Address>
|
||||
<ByteObject>0</ByteObject>
|
||||
<HtxType>0</HtxType>
|
||||
<ManyObjects>0</ManyObjects>
|
||||
<SizeOfObject>0</SizeOfObject>
|
||||
<BreakByAccess>0</BreakByAccess>
|
||||
<BreakIfRCount>1</BreakIfRCount>
|
||||
<Filename>\netapp2\slamnia\3MIC\2s\BE-CHTI\assembleur\chti23\soft\PjtKEIL_StepDFT\Src\DFT.s</Filename>
|
||||
<ExecCommand></ExecCommand>
|
||||
<Expression>\\StepDFT\Src/DFT.s\62</Expression>
|
||||
</Bp>
|
||||
</Breakpoint>
|
||||
<WatchWindow1>
|
||||
<Ww>
|
||||
<count>0</count>
|
||||
<WinNumber>1</WinNumber>
|
||||
<ItemText>r5</ItemText>
|
||||
</Ww>
|
||||
<Ww>
|
||||
<count>1</count>
|
||||
<WinNumber>1</WinNumber>
|
||||
<ItemText>r0,0x0A</ItemText>
|
||||
</Ww>
|
||||
<Ww>
|
||||
<count>2</count>
|
||||
<WinNumber>1</WinNumber>
|
||||
<ItemText>r4</ItemText>
|
||||
</Ww>
|
||||
<Ww>
|
||||
<count>3</count>
|
||||
<WinNumber>1</WinNumber>
|
||||
<ItemText>r3</ItemText>
|
||||
</Ww>
|
||||
<Ww>
|
||||
<count>4</count>
|
||||
<WinNumber>1</WinNumber>
|
||||
<ItemText>r2</ItemText>
|
||||
</Ww>
|
||||
<Ww>
|
||||
<count>5</count>
|
||||
<WinNumber>1</WinNumber>
|
||||
<ItemText>Res_DFT[k]</ItemText>
|
||||
</Ww>
|
||||
</WatchWindow1>
|
||||
<MemoryWindow1>
|
||||
<Mm>
|
||||
<WinNumber>1</WinNumber>
|
||||
<SubType>0</SubType>
|
||||
<ItemText>r0</ItemText>
|
||||
<AccSizeX>0</AccSizeX>
|
||||
</Mm>
|
||||
</MemoryWindow1>
|
||||
<MemoryWindow2>
|
||||
<Mm>
|
||||
<WinNumber>2</WinNumber>
|
||||
<SubType>0</SubType>
|
||||
<ItemText>r0</ItemText>
|
||||
<AccSizeX>0</AccSizeX>
|
||||
</Mm>
|
||||
</MemoryWindow2>
|
||||
<Tracepoint>
|
||||
<THDelay>0</THDelay>
|
||||
</Tracepoint>
|
||||
|
@ -267,7 +332,7 @@
|
|||
<OPTFL>
|
||||
<tvExp>1</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<IsCurrentTarget>1</IsCurrentTarget>
|
||||
<IsCurrentTarget>0</IsCurrentTarget>
|
||||
</OPTFL>
|
||||
<CpuCode>18</CpuCode>
|
||||
<DebugOpt>
|
||||
|
@ -624,6 +689,30 @@
|
|||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>1</GroupNumber>
|
||||
<FileNumber>2</FileNumber>
|
||||
<FileType>2</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>.\Src\DFT.s</PathWithFileName>
|
||||
<FilenameWithoutPath>DFT.s</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>1</GroupNumber>
|
||||
<FileNumber>3</FileNumber>
|
||||
<FileType>2</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>.\Src\Signal.asm</PathWithFileName>
|
||||
<FilenameWithoutPath>Signal.asm</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
</Group>
|
||||
|
||||
<Group>
|
||||
|
@ -634,7 +723,7 @@
|
|||
<RteFlg>0</RteFlg>
|
||||
<File>
|
||||
<GroupNumber>2</GroupNumber>
|
||||
<FileNumber>2</FileNumber>
|
||||
<FileNumber>4</FileNumber>
|
||||
<FileType>2</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
|
@ -654,7 +743,7 @@
|
|||
<RteFlg>0</RteFlg>
|
||||
<File>
|
||||
<GroupNumber>3</GroupNumber>
|
||||
<FileNumber>3</FileNumber>
|
||||
<FileNumber>5</FileNumber>
|
||||
<FileType>4</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
|
|
|
@ -388,6 +388,16 @@
|
|||
<FileType>1</FileType>
|
||||
<FilePath>.\Src\principal.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>DFT.s</FileName>
|
||||
<FileType>2</FileType>
|
||||
<FilePath>.\Src\DFT.s</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>Signal.asm</FileName>
|
||||
<FileType>2</FileType>
|
||||
<FilePath>.\Src\Signal.asm</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
|
@ -797,6 +807,16 @@
|
|||
<FileType>1</FileType>
|
||||
<FilePath>.\Src\principal.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>DFT.s</FileName>
|
||||
<FileType>2</FileType>
|
||||
<FilePath>.\Src\DFT.s</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>Signal.asm</FileName>
|
||||
<FileType>2</FileType>
|
||||
<FilePath>.\Src\Signal.asm</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
|
@ -1275,6 +1295,16 @@
|
|||
<FileType>1</FileType>
|
||||
<FilePath>.\Src\principal.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>DFT.s</FileName>
|
||||
<FileType>2</FileType>
|
||||
<FilePath>.\Src\DFT.s</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>Signal.asm</FileName>
|
||||
<FileType>2</FileType>
|
||||
<FilePath>.\Src\Signal.asm</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
|
|
|
@ -75,7 +75,7 @@
|
|||
<OPTFL>
|
||||
<tvExp>1</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<IsCurrentTarget>0</IsCurrentTarget>
|
||||
<IsCurrentTarget>1</IsCurrentTarget>
|
||||
</OPTFL>
|
||||
<CpuCode>18</CpuCode>
|
||||
<DebugOpt>
|
||||
|
@ -331,7 +331,7 @@
|
|||
<OPTFL>
|
||||
<tvExp>1</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<IsCurrentTarget>1</IsCurrentTarget>
|
||||
<IsCurrentTarget>0</IsCurrentTarget>
|
||||
</OPTFL>
|
||||
<CpuCode>18</CpuCode>
|
||||
<DebugOpt>
|
||||
|
|
Loading…
Reference in a new issue