Page 715 - 완) I MDP 프로젝트 작품 보고서(전체과 1학년)1.6
P. 715
while (1)
{
if (rok == 1) { //문열림으로 설정되있으면 모터 -90도
PORTB = 0xFF;
delay_us(850);
PORTB = 0x00;
delay_ms(23);
} else { //문닫힘으로 설정되있으면 모터 0도
PORTB = 0xff;
delay_us(1200);
PORTB = 0x00;
delay_ms(23);
}
run_doorlock();
}
}
void LCD(void)
{
char sbuf[16];
removeLine(0);
sprintf(sbuf, "Returned Book:%d", getBookCount()); //인식한 갯수를 출력
lcd_puts(sbuf);
}
void init(void)
{
if (eeprom_read(16) == 255) {
eeprom_write(16, 0);
}
SREG |= 0x80;
EIMSK=0b01100000; //인터럽트 5,6
EICRB=0b00101100;
DDRB = 0xff;
doorlock_init();
#asm("sei")
}
- 708 -