#include "stm32f4xx.h" #include "stdio.h" #include "CPU_init.h" #include "math.h" #include "LCD.h" #include "usart2.h" #include "adc_interrupt.h" #include "tftv2.h" #include "menu.h" // Index auf ZF-Filter (provisorisch) extern int Filter; // Empfangsfrequenz in internen Einheiten extern int NCO_Frequenz; extern TFT Tft; int main(void) { int j; char s[10]; // PLL, AHB-, APB1-, APB2-Clock, Pin-Definitionen, ADC, DAC, Timer initialisieren CPU_init(); // LCD initialisieren LCD_init(); // Sinustabelle für Oszillator berechnen ADC_SinusInit(); // Empfangsfrequenz einstellen (Radio Europe 1) NCO_Frequenz = (int)(183000.0 * 4.2949673e9 / 1e6); __enable_irq(); // Interrupts freigeben usart2_put("f oder b"); // Endlos-Hauptschleife für niederpriore Tasks (Display, Bedienung, usw.) while (1) { LCD_Interface(); // primitive Bedienung über UART if ((USART2->SR & 32) != 0) { j=usart2_get(s); if (j == 1) { if (s[0]=='b') { usart2_put("Bandbreite"); j=usart2_get(); usart2_put(j); Filter = j-5; } if(s[0]=='f') { usart2_put("Frequenz"); j=usart2_get(); usart2_put(j); // Skalierungsfaktor 2^32/1MHz NCO_Frequenz = (int)((float)(j) * 4.2949673e9 / 1e6); } } usart2_put("f oder b"); } // end if } }