Page 714 - 완) I MDP 프로젝트 작품 보고서(전체과 1학년)1.6
P. 714

#include  <stdio.h>


            void  init(void);           //PORT 지정
            void  LCD(void);            //LCD표시
            unsigned int rok = 0;


            void  openDoor() {         //문 열기
                 rok = 1;

            }


            void  closeDoor() {        //문 닫기
                 rok = 0;
            }


            void  setBookCount(unsigned char count) {      //책  개수  설정
                 eeprom_write(16, count);
            }


            unsigned char getBookCount() {                   //책  개수  반환
                 return eeprom_read(16);
            }



            interrupt  [EXT_INT5]  void ext_int5(void)    //문닫힘이  인식될 경우
            {
                        setBookCount(0);
                        lcd_clear();
                        removeAll();
                        LCD();
                        closeDoor();                           //잠금 해제
            }
            interrupt  [EXT_INT6]  void ext_int6(void)    //센서 입력
            {
                    setBookCount(getBookCount()  +  1);      //책갯수 +1
                    LCD();                                         //늘어난 수를 LCD에  출력
            }
            void  main(void)
            {
            init();



            LCD();



                                                         -  707  -
   709   710   711   712   713   714   715   716   717   718   719