石头雷
获得 0 次赞
帮助过0人
检测LCD1602忙信号程序如下,实现不了,有没有好的改进方案,或其他好的建议,(我已经用延时替代忙信号检测实现了字符显示) uint8_t ReadDataPort(void) { uint32_t temp; GPIO_InitTypeDef GPIO_InitStructure; RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA,ENABLE); GPIO_InitStructure.GPIO_Pin=GPIO_Pin_0|GPIO_Pin_1|GPIO_Pin_2|GPIO_Pin_3| GPIO_Pin_4|GPIO_Pin_5|GPIO_Pin_6|GPIO_Pin_7; GPIO_InitStructure.GPIO_Speed=GPIO_Speed_50MHz; GPIO_InitStructure.GPIO_Mode=GPIO_Mode_IPU; GPIO_Init(GPIOA,&GPIO_InitStructure); temp=GPIOA->IDR; GPIO_InitStructure.GPIO_Pin=GPIO_Pin_0|GPIO_Pin_1|GPIO_Pin_2|GPIO_Pin_3| GPIO_Pin_4|GPIO_Pin_5|GPIO_Pin_6|GPIO_Pin_7; GPIO_InitStructure.GPIO_Speed=GPIO_Speed_50MHz; GPIO_InitStructure.GPIO_Mode=GPIO_Mode_Out_PP; GPIO_Init(GPIOA,&GPIO_InitStructure); return (uint8_t)temp; } void WaitForEnable(void) { uint8_t val; WriteDataPort(0xff); LCM_RS_0;LCM_RW_1;delay_us(1); LCM_EN_1;delay_us(1); val=ReadDataPort(); while(val&0x80) val=ReadDataPort(); LCM_EN_0; }
程序如下,引脚接的事LED灯,闪了6次 void EXTI1_IRQHandler(void) { int i; if(EXTI_GetITStatus(EXTI_Line1)!=RESET) { EXTI_ClearITPendingBit(EXTI_Line1); for(i=0;i