delay_ms(500);
}
问题:
当我屏蔽掉// LCD_ShowNum(160,270,lz/5,4,16);的时候就能输出正确的频率值;当我没屏蔽LCD_ShowNum(160,270,lz/5,4,16);时候就显示不正确了,数值在变。
以下是LCD.CDE 一部分程序
{
GPIO_InitTypeDef GPIO_InitStructure;
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOC|RCC_APB2Periph_GPIOB|RCC_APB2Periph_AFIO, ENABLE);
GPIO_PinRemapConfig(GPIO_Remap_SWJ_JTAGDisable , ENABLE);
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_10|GPIO_Pin_9|GPIO_Pin_8|GPIO_Pin_7|GPIO_Pin_6; //GPIO_Pin_10
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP; //???ì????
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_Init(GPIOC, &GPIO_InitStructure); //GPIOC
//GPIO_WriteBit(GPIOC,GPIO_Pin_10|GPIO_Pin_9|GPIO_Pin_8|GPIO_Pin_7|GPIO_Pin_6,Bit_SET);
GPIO_SetBits(GPIOC,GPIO_Pin_10|GPIO_Pin_9|GPIO_Pin_8|GPIO_Pin_7|GPIO_Pin_6);
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_All; //
GPIO_Init(GPIOB, &GPIO_InitStructure); //GPIOB
//GPIO_WriteBit(GPIOC,GPIO_Pin_All,Bit_SET);
GPIO_SetBits(GPIOB,GPIO_Pin_All);
delay_ms(50); // delay 50 ms
}
以下是time.c的程序
{
void Timerx_Init(u16 arr,u16 psc)
{
TIM_TimeBaseInitTypeDef TIM_TimeBaseStructure;
NVIC_InitTypeDef NVIC_InitStructure;
RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM3, ENABLE); //?±??????
TIM_TimeBaseStructure.TIM_Period = 50000; //?è???????????ü??????×°????????×?????×°???????÷???????? ??????5000??500ms
TIM_TimeBaseStructure.TIM_Prescaler =(7200-1); //?è??????×÷??TIMx?±?????????????¤·????? 10Khz??????????
TIM_TimeBaseStructure.TIM_ClockDivision = 0; //?è???±??·???:TDTS = Tck_tim
TIM_TimeBaseStructure.TIM_CounterMode = TIM_CounterMode_Up; //TIM?ò??????????
TIM_TimeBaseInit(TIM3, &TIM_TimeBaseStructure); //?ù??TIM_TimeBaseInitStruct?????¨????????????TIMx???±???ù??????
TIM_ITConfig( //?????ò???§?????¨??TIM????
TIM3, //TIM2
TIM_IT_Update | //TIM ??????
TIM_IT_Trigger, //TIM ??·???????
ENABLE //????
);
NVIC_InitStructure.NVIC_IRQChannel = TIM3_IRQn; //TIM3????
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0x00; //??????????0??
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0x00; //????????3??
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; //IRQ?¨??±?????
NVIC_Init(&NVIC_InitStructure); //?ù??NVIC_InitStruct?????¨???????????????èNVIC?????÷
TIM_Cmd(TIM3, ENABLE); //????TIMx???è
}
}
一下是exti.c的程序
{
void EXTIX_Init(void)
{
GPIO_InitTypeDef GPIO_InitStructure;
EXTI_InitTypeDef EXTI_InitStructure;
NVIC_InitTypeDef NVIC_InitStructure;
GPIO_PinRemapConfig(GPIO_Remap_SWJ_JTAGDisable , ENABLE); //??±?jtag
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA|RCC_APB2Periph_AFIO,ENABLE);
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IPD;
GPIO_Init(GPIOA, &GPIO_InitStructure);
//GPIOA.0 ?????????°??????????????
GPIO_EXTILineConfig(GPIO_PortSourceGPIOA,GPIO_PinSource0);
EXTI_InitStructure.EXTI_Line=EXTI_Line0;
EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt;
EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Rising;
EXTI_InitStructure.EXTI_LineCmd = ENABLE;
EXTI_Init(&EXTI_InitStructure); //?ù??EXTI_InitStruct?????¨???????????????èEXTI?????÷
NVIC_InitStructure.NVIC_IRQChannel = EXTI0_IRQn; //????°??ü?ù?????????????¨??
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0x02; //??????????2
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0x02; //×???????2
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; //?????????????¨??
NVIC_Init(&NVIC_InitStructure); //?ù??NVIC_InitStruct?????¨???????????????èNVIC?????÷
}
}
之所以贴出以上程序是:我想既然LCD函数影响了输出,是不是公用了管脚?还是什么的
希望知道!!!!!