#include "iom16v.h"
void io_init(void)
{
DDRA=0x00;
PORTA=0xFF;
DDRD = 0xFF;
PORTD = 0xFF;
}
void main(void)
{ unsigned char i;
unsigned char g;
io_init();
while (1)
{
if ((PINA & (1 << PA0)) == 0) {
PORTD = (1 << PD0);
}
if ((PINA & (1 << PA1)) == 0) {
PORTD = (1 << PD1);
}
if ((PINA & (1 << PA2)) == 0) {
PORTD = (1 << PD2);
}
if ((PINA & (1 << PA3)) == 0) {
PORTD = (1 << PD3);
}
}
}
小弟请教各位高手,按下按钮1,2,3,4,对应的PD口是怎么变化的?最好解释一下为什么,小弟在此谢过了~~