本帖最后由 250052460 于 2015-1-20 09:04 编辑
74hc164加NPN三极管控制PATLITE报警器(npn型),74hc164输出为乱码,容易受干扰。怎么解决该问题?
程序:
void OUTPUT_Parallel(uint16_t ShowValue)
{
uint8_t Count;
#if 1
LPC_GPIO2->FIOSET |=OUTCLK1;
Delay_10ns(10);
for(Count=0;Count<=9;Count++)
{
if((ShowValue&0x200)==0x200)
{
LPC_GPIO2->FIOSET |= OUTDATA1;
LPC_GPIO2->FIOSET |= OUTDATA1;
} /* 配置OUTDATA1输出1 */
else
{
LPC_GPIO2->FIOCLR |=OUTDATA1;
LPC_GPIO2->FIOCLR |=OUTDATA1;
}
ShowValue<<=1;
Delay_10ns(10);
LPC_GPIO2->FIOCLR |=OUTCLK1;
LPC_GPIO2->FIOCLR |=OUTCLK1;
Delay_10ns(20);
LPC_GPIO2->FIOSET |=OUTCLK1;
LPC_GPIO2->FIOSET |=OUTCLK1;
Delay_10ns(10);
}
LPC_GPIO2->FIOCLR |=OUTCLK1;
#endif
LPC_GPIO2->FIOCLR |=OUTCLK1;
}
|