以下PROG是修改自REMOTE的EX
ti5是否能CHECK到有DATA1有多少下PULSE呢?
用示波器測出 PC5 本來有13下
但PROG只CHECK出5-7下,求幫幫忙,非常感謝
#include "cardread.h"
u32 t1, T;
u32 Remote_Odr;
void Remote_Init(void)
{
RCC->APB2ENR|=1<<4;
GPIOC->CRL&=0XFFF0FFFF;
GPIOC->CRL|=0X00080000;
GPIOC->ODR|=1<<4;
Ex_NVIC_Config(GPIO_C,4,FTIR);
MY_NVIC_Init(0,0,EXTI4_IRQChannel,0);
RCC->APB2ENR|=1<<5;
GPIOC->CRL&=0XFF0FFFFF;
GPIOC->CRL|=0X00800000;
GPIOC->ODR|=1<<5;
Ex_NVIC_Config(GPIO_C,5,FTIR);
MY_NVIC_Init(0,0,EXTI9_5_IRQChannel,0);
}
void EXTI4_IRQHandler(void)
{
u32 Break_out = 0,T = 0;
u8 RODATA;
Remote_Odr = 0;
EXTI->IMR&=~(1<<5);
T++; t1=1;
RODATA=0;
Remote_Odr+=RODATA;
Remote_Odr<<=1;
while(1)
{
Break_out++;
if(Break_out == 1000000 || T == 26)
break;
if(DATA0 && DATA1)
{
t1++;
if(!DATA0)
{
T++;
RODATA=0;
Remote_Odr+=RODATA;
Remote_Odr<<=1;
}
if(!DATA1)
{
T++;
RODATA=1;
Remote_Odr+=RODATA;
Remote_Odr<<=1;
}
}
}
EXTI->R=1<<4;
EXTI->IMR|=1<<5;
}
void EXTI9_5_IRQHandler(void)
{
u32 Break_out = 0;
u8 RODATA;
u32 T = 0;
u32 Remote_Odr = 0;
EXTI->IMR&=~(1<<4);
T++; t1 = 1;
RODATA=1;
Remote_Odr+=RODATA;
Remote_Odr<<=1;
while(1)
{
Break_out++;
if(Break_out == 1000000 || T == 26)
break;
if(DATA1)
{
t1++;
if(!DATA1)
{
T++;
RODATA=1;
Remote_Odr+=RODATA;
Remote_Odr<<=1;
}
}
}
EXTI->R=1<<5;
EXTI->IMR|=1<<4;
}