Hallo,

Danke für die schnelle Antwort.
ich habe Ihren Hinweise befolgen, was Sie oben erwähnt haben, aber leider immer erfolglos.
Langsam langsam verzweifle ich an das Bord. es muss irgendwie an das Bord liegen. weil das Code soll fehlerlos laufen oder?

Ich verwende den Atolic/TrueSTUDIO STM32 Lite 2.1.0 (STMicroelectronics ST-Link_V2_USBdriver).

Danke.


/* Includes */

#include <stddef.h>
#include "stm32f10x.h"

/* ---------------------------Private typedef -------------------------------*/
TIM_TimeBaseInitTypeDef TIM2_Configuration;
NVIC_InitTypeDef NVIC_InitStructure;
//TIM_OCInitTypeDef Output_Compare;
TIM_ICInitTypeDef Input_Capture;
GPIO_InitTypeDef GPIO_Inity;

/*---------------------------Global Variable---------------------------------*/
volatile uint32_t INT_Counter = 0;



/************************************************** *****************************
# * Function Name : RCC_cONFIGURATION
# * Description : .
# * Input : None
# * Output : None
# * Return : None
# ************************************************** *****************************/

void RCC_Configuration(void)
{
/* TIM2clock= SystemCoreColock, enable */
RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM2, ENABLE);

/* GPIOA clock enable */
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, ENABLE);

/* ALTERNATE FUNCTION ENABLE*/
RCC_APB2PeriphClockCmd(RCC_APB2Periph_AFIO, ENABLE);

/* GPIOC clock enable */
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOC, ENABLE);
}

/************************************************** *****************************
# * Function Name : GPIO_SETUP
# * Description : .
# * Input : None
# * Output : None
# * Return : None
# ************************************************** *****************************/

void GPIO_Setup ()
{
/* LEDs pin (PC.08 and 09) configuration */
GPIO_Inity.GPIO_Pin =GPIO_Pin_8 | GPIO_Pin_9;
GPIO_Inity.GPIO_Mode =GPIO_Mode_Out_PP;
GPIO_Inity.GPIO_Speed =GPIO_Speed_50MHz;

/* TIM2 PA.0 configuration*/
GPIO_Inity.GPIO_Mode =GPIO_Mode_IN_FLOATING;// soll ich PULL-Down oder Pull up werwenden wenn der
//Eingang als Pull-Down Konfiguriert?
//Der AF weil bei dieser Pin wir der Alternate Function verwendet
GPIO_Inity.GPIO_Speed =GPIO_Speed_50MHz;
GPIO_Inity.GPIO_Pin =GPIO_Pin_0;

GPIO_Init(GPIOA, &GPIO_Inity);
GPIO_Init(GPIOC, &GPIO_Inity);

}

/************************************************** *****************************
# * Function Name : TIM2_SETUP
# * Description : Timer2 as Output/Compare
# * Input : None
# * Output : None
# * Return : None
# ************************************************** *****************************/

void TIM2_SETUP ()
{

/*----Time_Base_Counter-----*/

TIM2_Configuration.TIM_CounterMode= TIM_CounterMode_Up;
TIM2_Configuration.TIM_ClockDivision= 0;
TIM2_Configuration.TIM_Period=65535;
TIM2_Configuration.TIM_Prescaler=1;
TIM_TimeBaseInit(TIM2,&TIM2_Configuration);

/*----Input_Capture Mode CH1----*/
Input_Capture.TIM_ICSelection = TIM_ICSelection_DirectTI;// hier verstehe ich der Unterschied
// zwischen Direct und Indirekt nicht
//wirklich, aber ich verwende Direct weil ich
// kein remaping durchführe
Input_Capture.TIM_ICPolarity= TIM_ICPolarity_Rising;
Input_Capture.TIM_ICPrescaler = TIM_ICPSC_DIV1;
Input_Capture.TIM_Channel= TIM_Channel_1;
Input_Capture.TIM_ICFilter = 0;

TIM_ICInit(TIM2, &Input_Capture);
TIM_Cmd(TIM2, ENABLE);

/*----Enable the Capture Compare Interrupt Request-----*/
TIM_ITConfig(TIM2, TIM_IT_CC1, ENABLE);

}

/************************************************** *****************************
# * Function Name : Configure the nested vectored interrupt controller.
# * Description : .
# * Input : None
# * Output : None
# * Return : None
# ************************************************** *****************************/
void NVIC_SETUP ()
{
/* Enable the TIM2 global Interrupt */

NVIC_InitStructure.NVIC_IRQChannelPreemptionPriori ty=0;
NVIC_InitStructure.NVIC_IRQChannelSubPriority=1;
NVIC_InitStructure.NVIC_IRQChannel= TIM2_IRQn;
NVIC_InitStructure.NVIC_IRQChannelCmd= ENABLE;
NVIC_Init(&NVIC_InitStructure);
}

/************************************************** *****************************
# * Function Name : delayloop
# * Description : .
# * Input : None
# * Output : None
# * Return : None
# ************************************************** *****************************/

void delayLoop()
{
volatile uint32_t delayCount = 1000000;
while (delayCount > 0)
{
delayCount--;
}
}


/*+++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++*/

int main (void)
{
RCC_Configuration();
GPIO_Setup();
TIM2_SETUP();
NVIC_SETUP();



while (1)
{

if(INT_Counter ==1)
{
GPIOC->BSRR = GPIO_Pin_8; // LED On
delayLoop();

GPIOC->BRR = GPIO_Pin_8; // LED Off
delayLoop();

GPIOC->BSRR = GPIO_Pin_8; // LED On
delayLoop();

GPIOC->BRR = GPIO_Pin_8; // LED Off
delayLoop();
GPIOC->BSRR = GPIO_Pin_9; // LED On
delayLoop();

GPIOC->BRR = GPIO_Pin_9; // LED Off
delayLoop();


}

}
return 0;
}

void TIM2_IRQHandler (void)
{
// Interrupt Flag muß per Software gelöscht werden

TIM_ClearFlag(TIM2, TIM_FLAG_Update);

INT_Counter++;
}