Page 107 - MDP2022-2
P. 107

2.  코드


            1.  STM  코드  (아두이노  ide)




            #include  <Wire.h>
            #include  <LiquidCrystal_I2C.h>


            LiquidCrystal_I2C  lcd(0x27,  16,2);


            #define  Data1  digitalRead(PF0)
            #define  Data2  digitalRead(PF1)
            #define  on_off  digitalRead(PF2)


            uint8_t  state  =  0;


            void  debuging_command(){
                switch(state){
                    case  0x01  :
                        digitalWrite(PE0,  1);
                        break;
                    case  0x02  :
                        digitalWrite(PE5,  1);
                        break;
                    case  0x04  :
                        digitalWrite(PE6,  1);
                        break;

                    case  0x10  :
                        digitalWrite(PE0,  0);
                        break;
                    case  0x20  :
                        digitalWrite(PE5,  0);
                        break;
                    case  0x40  :
                        digitalWrite(PE6,  0);
                        break;
                }
            }


            volatile  int  a  =  0;
            int  value  =  0;
            void  activee_command(uint8_t  data){
                switch  (data  &  0x07)
                {
   102   103   104   105   106   107   108   109   110   111   112