#define SPI_MASTER SPI1 #include "stm32f10x.h" #include "LCD.h" #include "stm32f10x_conf.h" #define ADC1_DR_Address ((uint32_t)0x4001244C) #define ADC2_DR_Address ((uint32_t)0x40013C4C) #define BufferSize 32 GPIO_InitTypeDef GPIO_InitStructure; DMA_InitTypeDef DMA_InitStructure; SPI_InitTypeDef SPI_InitStructure; uint8_t SPI_MASTER_Buffer[BufferSize] = {0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F, 0x20}; uint8_t TxIdx = 0; int a = 0; int b = 0; int E = 0; int H = 0; int T = 0; int Z = 0; int Sample[1000]; int i; int j; int adcmode = 1; int ADC1ConvertedValue = 0; int z; //////////////////////////////////////////////////////////////////////////////////////////////////////// //------------------------ RCC konfigurieren ---------------------------------------------------------// //////////////////////////////////////////////////////////////////////////////////////////////////////// // void RCC_konfigurieren(void) // // { // // RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, ENABLE); // RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB, ENABLE); // RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOC, ENABLE); // RCC_APB2PeriphClockCmd(RCC_APB2Periph_ADC1 | RCC_APB2Periph_ADC2 | RCC_APB2Periph_ADC3, ENABLE); // RCC_AHBPeriphClockCmd (RCC_AHBPeriph_DMA1 , ENABLE); // RCC_APB2PeriphClockCmd(RCC_APB2Periph_AFIO | RCC_APB2Periph_SPI1, ENABLE); RCC_ADCCLKConfig(RCC_PCLK2_Div4); // // /* PCLK2 = HCLK/2 */ RCC_PCLK2Config(RCC_HCLK_Div2); } // //////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////// //------------------------ GPIO konfigurieren --------------------------------------------------------// //////////////////////////////////////////////////////////////////////////////////////////////////////// // void GPIO_konfigurieren(void) // // { // // GPIO_InitTypeDef GPIO_InitStructure; // // //------------------------ LCD-Port konfigurieren ----------------------------------------------------// GPIO_InitStructure.GPIO_Pin = GPIO_Pin_10 | GPIO_Pin_11 | GPIO_Pin_12 | // GPIO_Pin_13 | GPIO_Pin_14 | GPIO_Pin_15; // GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; // GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP; // GPIO_Init(GPIOB, &GPIO_InitStructure); // // GPIO_InitStructure.GPIO_Pin = GPIO_Pin_6; // GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP; // GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; // GPIO_Init(GPIOC, &GPIO_InitStructure); // // // //------------------------ ADC-Port konfigurieren ----------------------------------------------------// GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0 | GPIO_Pin_1 | GPIO_Pin_2; // GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AIN; // GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; // GPIO_Init(GPIOC, &GPIO_InitStructure); // /* Configure SPI_MASTER pins: NSS, SCK and MOSI */ GPIO_InitStructure.GPIO_Pin = GPIO_Pin_4 | GPIO_Pin_5 | GPIO_Pin_7 | GPIO_Pin_6; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP; GPIO_Init(GPIOA, &GPIO_InitStructure); } // //----------------------------------------------------------------------------------------------------// //////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////// //------------------------ Warteschleife erstellen -------------------------------// //////////////////////////////////////////////////////////////////////////////////// // void mwait_ms(int wartezeit) // // { // // int i; // int j; // for (i=0; i