標(biāo)題:
STM32 OLED頻譜程序(fft)
[打印本頁]
作者:
磊雷雷
時間:
2020-1-15 21:26
標(biāo)題:
STM32 OLED頻譜程序(fft)
本人使用STM32F103C8T6和oled屏幕顯示頻譜,已經(jīng)成功調(diào)試,鏈接如下:
https://www.bilibili.com/video/av61148722
,效果可觀看嗶哩嗶哩視頻比較稀有使用hal庫
一下是部分代碼
void SystemClock_Config(void);
/* USER CODE BEGIN PFP */
/* Private function prototypes -----------------------------------------------*/
/* ½öÔêDí±¾ÎļtÄúμ÷óÃμÄoˉêyéùÃ÷ */
static void PrintfLogo(void);
static void arm_rfft_fast_f32_app(void);
static void arm_rfft_q15_app(void);
static void arm_rfft_q31_app(void);
void PowerMag(uint16_t _usFFTPoints);
void DSP_FFT1024(void);
void DSP_FFT256(void);
/* êäèëoíêä3ö»o3å */
#define TEST_LENGTH_SAMPLES 2048
static float32_t testInput_f32_10khz[TEST_LENGTH_SAMPLES];
static float32_t testOutput_f32_10khz[TEST_LENGTH_SAMPLES];
static float32_t testOutput[TEST_LENGTH_SAMPLES];
static q15_t testInput_q15_50hz[TEST_LENGTH_SAMPLES];
static q15_t testOutputQ15[TEST_LENGTH_SAMPLES];
static q15_t testOutput_q15_50hz[TEST_LENGTH_SAMPLES];
static q31_t testInput_q31_50hz[TEST_LENGTH_SAMPLES];
static q31_t testOutputQ31[TEST_LENGTH_SAMPLES];
static q31_t testOutput_q31_50hz[TEST_LENGTH_SAMPLES];
void OLED_Draw4Line(u8 x1,u8 y1,u8 x2,u8 y2);
void OLED_Draw2Line(u8 x1,u8 y1,u8 x2,u8 y2);
u8 str[100];
/* 񄠨 */
uint32_t fftSize = 1024;
uint32_t ifftFlag = 0;
uint32_t doBitReverse = 1;
/* USER CODE END PFP */
void DSP_FFT256(void)
{
uint16_t i,x,y;
/* »ñμÃ256¸ö2éÑùμã */
for (i = 0; i < 256; i++)
{
input[i] =(((signed short)uhADCxConvertedValue[0])-2048) << 16;
delay_us(100);
}
/* ¼ÆËã256μãFFT
output£oêä3ö½á1û£¬¸ß16λêÇDé2¿£¬μí16λêÇêμ2¿¡£
input £oêäèëêy¾Y£¬¸ß16λêÇDé2¿£¬μí16λêÇêμ2¿¡£
μúèy¸ö2Îêy±ØDëêÇ256¡£
*/
cr4_fft_256_stm32(output, input, 256);
/* Çó·ùÖμ */
PowerMag(256);
OLED_Clear();
for(i=0;i<128;i++)
{
x = i;
y = Mag[i]/1.6;
OLED_Draw4Line(x,0,x,y);
}
OLED_Refresh();
/* ′òó¡êä3ö½á1û */
// for (i = 0; i < 256/2; i++)
// {
// printf("%4d, %.2f %10d\n",i,(((float)i*10000/256)),Mag[i]);
// }
}
復(fù)制代碼
fftOLED顯示(Over).7z
2020-1-16 18:26 上傳
點擊文件名下載附件
下載積分: 黑幣 -5
3.28 MB, 下載次數(shù): 125, 下載積分: 黑幣 -5
作者:
373996214
時間:
2020-5-5 23:15
感謝分享!好資料,學(xué)習(xí)了。
歡迎光臨 (http://www.torrancerestoration.com/bbs/)
Powered by Discuz! X3.1