Forum: Mikrocontroller und Digitale Elektronik IRMP IR Receiver


von Eray B. (eray84)


Lesenswert?

Hi,
I am trying to import IRMP library to my board. I use STM32103VET6 mcu 
and standart peripheral library. For receiving IR signal i use 38Khz IR 
receiver, VS1738. MCU clock frequency is 16Mhz, external clock. I use 
PORTA, PIN_1 of STM32 for receiving port. When i send any IR signal from 
any remote, i can not get data. My setups are below. Any advise ?

By the way i can not call "IRMP_DATA irmp_data;" in main, compiler gives 
undecleared error, so i call it outside main.
1
IRMP_DATA irmp_data;
2
int main (void)
3
{ 
4
5
    irmp_init();                                                            
6
    timer5_init();                                                          
7
8
    for (;;)
9
    {
10
        if (irmp_get_data (&irmp_data))
11
        {
12
            // ir signal decoded, do something here...
13
        }
14
    }
15
}
1
void TIM5_IRQHandler(void)                                                       
2
{
3
4
  TIM_ClearITPendingBit(TIM5, TIM_IT_Update);
5
  (void) irmp_ISR();   
6
                                                     
7
}
1
uint32_t SysCtlClockGet(void)
2
{
3
4
    RCC_ClocksTypeDef RCC_ClocksStatus;
5
    RCC_GetClocksFreq(&RCC_ClocksStatus);
6
    return RCC_ClocksStatus.SYSCLK_Frequency;
7
8
}
1
void timer5_init (void)
2
{
3
    TIM_TimeBaseInitTypeDef TIM_TimeBaseStructure;
4
    NVIC_InitTypeDef NVIC_InitStructure;
5
    RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM5, ENABLE);
6
7
    TIM_TimeBaseStructure.TIM_ClockDivision                 = TIM_CKD_DIV1;
8
    TIM_TimeBaseStructure.TIM_CounterMode                   = TIM_CounterMode_Up;
9
    TIM_TimeBaseStructure.TIM_Period                        = 999;
10
    TIM_TimeBaseStructure.TIM_Prescaler                     = 106;//((F_CPU / F_INTERRUPTS)/8) - 1;
11
    TIM_TimeBaseInit(TIM5, &TIM_TimeBaseStructure);
12
13
    TIM_ITConfig(TIM5, TIM_IT_Update, ENABLE);
14
15
    NVIC_InitStructure.NVIC_IRQChannel                      = TIM5_IRQn;
16
    NVIC_InitStructure.NVIC_IRQChannelCmd                   = ENABLE;
17
    NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority    = 0x0F;
18
    NVIC_InitStructure.NVIC_IRQChannelSubPriority           = 0x0F;
19
    NVIC_Init(&NVIC_InitStructure);
20
21
    TIM_Cmd(TIM5, ENABLE);
22
}

Bitte melde dich an um einen Beitrag zu schreiben. Anmeldung ist kostenlos und dauert nur eine Minute.
Bestehender Account
Schon ein Account bei Google/GoogleMail? Keine Anmeldung erforderlich!
Mit Google-Account einloggen
Noch kein Account? Hier anmelden.