Page 20 - 2020학년도 MDP과제발표회 자료집 (제어과) (1)
P. 20

void  init_LCD(){                        //LCD 초기  설정
                    LCD_cmd_write(0x38);        //Function  Set  ->  8bit  ,  2Line  ,  5*8  dot
                    delay_us(100);
                    LCD_cmd_write(0x38);

                    LCD_cmd_write(0x08);        //Display  OFF  (1000)  ->  (2)display  ,  (1)cursor  ,  (0)blink
                    LCD_cmd_write(0x01);        //Display  Clear  ->  화면  클리어  커서  복귀,
                    LCD_cmd_write(0x06);        //Entry  mode  ->  I/D  1  ,  S  0  ->  S 가  이면  디스플레이  고정0
                    LCD_cmd_write(0x0c);        //Display  ON  (1100)  ->  (2)display  ,  (1)cursor  ,  (0)blink
            }



            void  init_system(){  //LCD 연결  포트  기본설정
                    DDRC  =  0xff;
                    DDRG  =  0xff;
                    PORTC  =  0xff;

                    PORTG  =  0xff;
            }


            /*
            void  LCD_String(flash  unsigned  char  str[]){

                    flash  unsigned  char  *pStr  =  0;
                    pStr  =  str;
                    while(*pStr)  LCD_data_write(*pStr++);
            }
            */


            //flash  +  []  =  가능  ,  flash  +  []  +  *  =  불가능
            void  LCD_String(flash  unsigned  char  string[])  //Flash   메모리를  이용한  문자열  출력
            {
                    unsigned  int  i  =  0;


                    while(i+1)
                    {
                            LCD_data_write(string[i]);
                            i++;

                            if(string[i]=='\0')          // 문자열  마무리  직전  '/0' 을  만나면  출력  종료
                            i=-1;
                    }
            }


            void  main(void)
            {


                                                         -  21  -
   15   16   17   18   19   20   21   22   23   24   25