AVR m16引脚输出能力很菜,不知道为什么?请教
最小系统如图所示,熔丝配置内部8M+禁止JTAG,AVREF悬空,板子上M16的滤波电容没焊,在输出高电平驱动ULN2803的时候输出高电平会被拉的很低,查数据手册发现M16完全可以驱动ULN2803,现在我就很纳闷,ULN2803也换过尝试还是不行,M16也换过也不行。 硬件看不出来,就看看程序喽。 .titrwh 发表于 2013-1-9 14:51 static/image/common/back.gif硬件看不出来,就看看程序喽。
void port_init(void)
{
PORTA = 0x00;
DDRA= 0xFF;
PORTB = 0x00;
DDRB= 0xFF;
PORTC = 0x00; //m103 output only
DDRC= 0xFF;
PORTD = 0x00;
DDRD= 0xFF;
}
//call this routine to initialize all peripherals
void init_devices(void)
{
//stop errant interrupts until set up
CLI(); //disable all interrupts
port_init();
MCUCR = 0x00;
GICR= 0x00;
TIMSK = 0x00; //timer interrupt sources
SEI(); //re-enable interrupts
//all peripherals are now initialized
}
int main(void)
{
for(;;)
{
PORTA = 0xff;
PORTB = 0xff;
PORTC = 0xff;
PORTD = 0xff;
}
return ;
}
主函数木有调用“init_devices();”??? 灰机所言甚是 晶振呢?
空Pin都不处理?
MCU所有引脚全部输出?
不同引脚的驱动能力是不一样的。
页:
[1]