اطلاعیه

Collapse
No announcement yet.

راه اندازی ال سی دی ان 96 با میکرو lpc1768

Collapse
X
 
  • فیلتر
  • زمان
  • Show
Clear All
new posts

    راه اندازی ال سی دی ان 96 با میکرو lpc1768

    سلام به همه.
    از دوستان کسی مثال راه اندازی این ال سی دی را با 1768 داره.فقط میخوام ال سی دی روشن بشه و یک عکس را روش نمایش بدم.خیلی واجبه.
    پیشاپیش از راهنمایی شما ممنون
    :angry:
    راه را راهبر قرار مده،بلکه راهي ناپيموده را آغاز کن و از خود راهي بر جاي بگذار.

    #2
    پاسخ : راه اندازی ال سی دی ان 96 با میکرو lpc1768

    سلام.
    مثال برای این lcd حتی از lcd کاراکتری هم بیشتره.نمیتونی ازشون جواب بگیری؟
    8 بیتی میخاهی راه اندازی کنی یا 16 بیتی؟
    تولید کننده انواع تابلو فرمان آسانسور با تکنولوژی روز دنیا

    دیدگاه


      #3
      پاسخ : راه اندازی ال سی دی ان 96 با میکرو lpc1768

      نوشته اصلی توسط mehdi_nxp
      سلام.
      مثال برای این lcd حتی از lcd کاراکتری هم بیشتره.نمیتونی ازشون جواب بگیری؟
      8 بیتی میخاهی راه اندازی کنی یا 16 بیتی؟
      سلام،
      16 بیتی
      برنامه ها را که اجرا می کنم فقط ال سی دی روشن میشه و سفید میمونه.
      اگر امکان داره یک پروژه ساده که فقط ال سی دی روشن بشه و یک عکس را نمایش بده با شماتیک بذارید خیلی ممنون میشم
      راه را راهبر قرار مده،بلکه راهي ناپيموده را آغاز کن و از خود راهي بر جاي بگذار.

      دیدگاه


        #4
        پاسخ : راه اندازی ال سی دی ان 96 با میکرو lpc1768

        شما این هدر رو به پروژه اضافه کن.
        پایه های کنترلی که اول هدر مشخصه که باید به کجا وصل بشن.
        پایه های دیتا هم از پایه 14 پورت 1 شروع میشن تا 29.

        کد:
        #ifndef _TFTLCD_FUNCTIONS_H_
        #define _TFTLCD_FUNCTIONS_H_
        
        
        #define TFTLCD_RST_LOW         LPC_GPIO1->FIOCLR=1<<10;
        #define TFTLCD_RST_HIGH        LPC_GPIO1->FIOSET=1<<10;
        #define TFTLCD_RS_LOW         LPC_GPIO1->FIOCLR=1<<8;
        #define TFTLCD_RS_HIGH         LPC_GPIO1->FIOSET=1<<8;
        #define TFTLCD_CS_LOW         LPC_GPIO1->FIOCLR=1<<9;
        #define TFTLCD_CS_HIGH         LPC_GPIO1->FIOSET=1<<9;
        #define TFTLCD_RD_LOW         LPC_GPIO1->FIOCLR=1<<1;
        #define TFTLCD_RD_HIGH         LPC_GPIO1->FIOSET=1<<1;
        #define TFTLCD_WR_LOW         LPC_GPIO1->FIOCLR=1<<4;
        #define TFTLCD_WR_HIGH         LPC_GPIO1->FIOSET=1<<4;
        
        /* LCD Command Codes */
        #define TS_INS_START_OSC      0x00
        #define TS_INS_DRIV_OUT_CTRL    0x01
        #define TS_INS_DRIV_WAV_CTRL    0x02
        #define TS_INS_ENTRY_MOD      0x03
        #define TS_INS_RESIZE_CTRL     0x04
        #define TS_INS_DISP_CTRL1      0x07
        #define TS_INS_DISP_CTRL2      0x08
        #define TS_INS_DISP_CTRL3      0x09
        #define TS_INS_DISP_CTRL4      0x0A
        #define TS_INS_RGB_DISP_IF_CTRL1  0x0C
        #define TS_INS_FRM_MARKER_POS    0x0D
        #define TS_INS_RGB_DISP_IF_CTRL2  0x0F
        #define TS_INS_POW_CTRL1      0x10
        #define TS_INS_POW_CTRL2      0x11
        #define TS_INS_POW_CTRL3      0x12
        #define TS_INS_POW_CTRL4      0x13
        #define TS_INS_GRAM_HOR_AD     0x20
        #define TS_INS_GRAM_VER_AD     0x21
        #define TS_INS_RW_GRAM       0x22
        #define TS_INS_POW_CTRL7      0x29
        #define TS_INS_FRM_RATE_COL_CTRL  0x2B
        #define TS_INS_GAMMA_CTRL1     0x30
        #define TS_INS_GAMMA_CTRL2     0x31
        #define TS_INS_GAMMA_CTRL3     0x32
        #define TS_INS_GAMMA_CTRL4     0x35 
        #define TS_INS_GAMMA_CTRL5     0x36
        #define TS_INS_GAMMA_CTRL6     0x37
        #define TS_INS_GAMMA_CTRL7     0x38
        #define TS_INS_GAMMA_CTRL8     0x39
        #define TS_INS_GAMMA_CTRL9     0x3C
        #define TS_INS_GAMMA_CTRL10     0x3D
        #define TS_INS_HOR_START_AD     0x50
        #define TS_INS_HOR_END_AD      0x51
        #define TS_INS_VER_START_AD     0x52
        #define TS_INS_VER_END_AD      0x53
        #define TS_INS_GATE_SCAN_CTRL1   0x60
        #define TS_INS_GATE_SCAN_CTRL2   0x61
        #define TS_INS_GATE_SCAN_CTRL3   0x6A
        #define TS_INS_PART_IMG1_DISP_POS  0x80
        #define TS_INS_PART_IMG1_START_AD  0x81
        #define TS_INS_PART_IMG1_END_AD   0x82
        #define TS_INS_PART_IMG2_DISP_POS  0x83
        #define TS_INS_PART_IMG2_START_AD  0x84
        #define TS_INS_PART_IMG2_END_AD   0x85
        #define TS_INS_PANEL_IF_CTRL1    0x90
        #define TS_INS_PANEL_IF_CTRL2    0x92
        #define TS_INS_PANEL_IF_CTRL3    0x93
        #define TS_INS_PANEL_IF_CTRL4    0x95
        #define TS_INS_PANEL_IF_CTRL5    0x97
        #define TS_INS_PANEL_IF_CTRL6    0x98      
        
        #define TS_SIZE_X          240
        #define TS_SIZE_Y          320
        #define TS_VAL_ENTRY_MOD      0x0030
        #define TS_INS_GRAM_ADX       TS_INS_GRAM_HOR_AD
        #define TS_INS_GRAM_ADY       TS_INS_GRAM_VER_AD
        #define TS_INS_START_ADX      TS_INS_HOR_START_AD
        #define TS_INS_END_ADX       TS_INS_HOR_END_AD
        #define TS_INS_START_ADY      TS_INS_VER_START_AD
        #define TS_INS_END_ADY       TS_INS_VER_END_AD
        
        
        #define RED             0x001F
        #define GREEN            0x07E0
        #define BLUE            0xF800
        #define YELLOW           0x07FF
        #define PURPLE           0xF81F
        #define BLACK            0x0000
        #define WHITE            0xFFFF
        
        #define HIGH 1
        #define LOW 0
        
        
        //***************************************************************
        void tftlcd_write_index_register(int command)
        	{
        	TFTLCD_RS_LOW;
        	LPC_GPIO1->FIOCLR=0xffff<<14;
        	LPC_GPIO1->FIOSET=command<<14;
        	TFTLCD_CS_LOW;
        	TFTLCD_CS_HIGH;
        	LPC_GPIO1->FIOCLR=0xffff<<14;
        	TFTLCD_RS_HIGH;
        	}
        //***************************************************************
        void tftlcd_write_wdr(int data)
        	{
        	LPC_GPIO1->FIOCLR=0xffff<<14;
        	LPC_GPIO1->FIOSET=data<<14;
        	TFTLCD_CS_LOW;
          TFTLCD_CS_HIGH;
        	}
        //***************************************************************
        void tftlcd_write_command(int index,int argument)
        	{
        	tftlcd_write_index_register(index);
        	tftlcd_write_wdr(argument);
        	}
        //***************************************************************
        void tftlcd_clear(int co)
        	{
        	int counter;
        
          tftlcd_write_index_register(TS_INS_START_ADX);
          tftlcd_write_wdr(0);
          tftlcd_write_index_register(TS_INS_END_ADX);
          tftlcd_write_wdr(239);
          tftlcd_write_index_register(TS_INS_GRAM_ADX);
          tftlcd_write_wdr(0);
          tftlcd_write_index_register(TS_INS_START_ADY);
          tftlcd_write_wdr(0);
          tftlcd_write_index_register(TS_INS_END_ADY);
          tftlcd_write_wdr(319);
        	tftlcd_write_index_register(TS_INS_GRAM_ADY);
          tftlcd_write_wdr(319);
        
          tftlcd_write_index_register(TS_INS_RW_GRAM);
        
          for(counter = 0;counter < 76800;counter++)
            tftlcd_write_wdr(co);
        	}
        //***************************************************************
        void tftlcd_init(void)
        	{
        	TFTLCD_RST_HIGH;
        	TFTLCD_CS_HIGH;
        	TFTLCD_RD_HIGH;
        	TFTLCD_WR_LOW;
          // Reset LCD Chipset
          TFTLCD_RST_LOW;
          delay_ms(50);
          TFTLCD_RST_HIGH;
          delay_ms(50);
        
        		tftlcd_write_index_register(0x00E3);
        		tftlcd_write_wdr(0x3008); 					//set the internal timing
        		tftlcd_write_index_register(0x00E7);
        		tftlcd_write_wdr(0x0012); 					//set the internal timing
        		tftlcd_write_index_register(0x00EF);
        		tftlcd_write_wdr(0x1231); 					//set the internal timing
        		tftlcd_write_index_register(TS_INS_START_OSC);
        		tftlcd_write_wdr(0x0001); 					//start oscillator
        		delay_ms(50);
        
        		tftlcd_write_index_register(TS_INS_DRIV_OUT_CTRL);
        		tftlcd_write_wdr(0x0000); 					//set SS, SM
        		tftlcd_write_index_register(TS_INS_DRIV_WAV_CTRL);
        		tftlcd_write_wdr(0x0700); 					//set 1 line inversion
        
        		tftlcd_write_index_register(TS_INS_ENTRY_MOD);
        		tftlcd_write_wdr(TS_VAL_ENTRY_MOD);			//set GRAM write direction, BGR=0
        
        		tftlcd_write_index_register(TS_INS_RESIZE_CTRL);
        		tftlcd_write_wdr(0x0000); 					//no resizing
        
        		tftlcd_write_index_register(TS_INS_DISP_CTRL2);
        		tftlcd_write_wdr(0x0202); 					//front & back porch periods = 2
        		tftlcd_write_index_register(TS_INS_DISP_CTRL3);
        		tftlcd_write_wdr(0x0000);
        		tftlcd_write_index_register(TS_INS_DISP_CTRL4);
        		tftlcd_write_wdr(0x0000);
        		tftlcd_write_index_register(TS_INS_RGB_DISP_IF_CTRL1);
        		tftlcd_write_wdr(0x0000); 					//select system interface
        		tftlcd_write_index_register(TS_INS_FRM_MARKER_POS);
        		tftlcd_write_wdr(0x0000);
        		tftlcd_write_index_register(TS_INS_RGB_DISP_IF_CTRL2);
        		tftlcd_write_wdr(0x0000);
        
        		tftlcd_write_index_register(TS_INS_POW_CTRL1);
        		tftlcd_write_wdr(0x0000);
        		tftlcd_write_index_register(TS_INS_POW_CTRL2);
        		tftlcd_write_wdr(0x0007);
        		tftlcd_write_index_register(TS_INS_POW_CTRL3);
        		tftlcd_write_wdr(0x0000);
        		tftlcd_write_index_register(TS_INS_POW_CTRL4);
        		tftlcd_write_wdr(0x0000);
        		delay_ms(200);
        
        		tftlcd_write_index_register(TS_INS_POW_CTRL1);
        		tftlcd_write_wdr(0x1690);
        		tftlcd_write_index_register(TS_INS_POW_CTRL2);
        		tftlcd_write_wdr(0x0227); //tftlcd_write_wdr(0x0137);
        		delay_ms(50);
        
        		tftlcd_write_index_register(TS_INS_POW_CTRL3);
        		tftlcd_write_wdr(0x001A); //tftlcd_write_wdr(0x013C);
        		delay_ms(50);
        
        		tftlcd_write_index_register(TS_INS_POW_CTRL4);
        		tftlcd_write_wdr(0x1800); //tftlcd_write_wdr(0x1400);
        		tftlcd_write_index_register(TS_INS_POW_CTRL7);
        		tftlcd_write_wdr(0x002A); //tftlcd_write_wdr(0x0007);
        		delay_ms(50);
        
        		tftlcd_write_index_register(TS_INS_GRAM_HOR_AD);
        		tftlcd_write_wdr(0x0000);
        		tftlcd_write_index_register(TS_INS_GRAM_VER_AD);
        		tftlcd_write_wdr(0x0000);
        
        		tftlcd_write_index_register(TS_INS_GAMMA_CTRL1);
        		tftlcd_write_wdr(0x0007);
        		tftlcd_write_index_register(TS_INS_GAMMA_CTRL2);
        		tftlcd_write_wdr(0x0605);
        		tftlcd_write_index_register(TS_INS_GAMMA_CTRL3);
        		tftlcd_write_wdr(0x0106);
        		tftlcd_write_index_register(TS_INS_GAMMA_CTRL4);
        		tftlcd_write_wdr(0x0206);
        		tftlcd_write_index_register(TS_INS_GAMMA_CTRL5);
        		tftlcd_write_wdr(0x0808);
        		tftlcd_write_index_register(TS_INS_GAMMA_CTRL6);
        		tftlcd_write_wdr(0x0007);
        		tftlcd_write_index_register(TS_INS_GAMMA_CTRL7);
        		tftlcd_write_wdr(0x0201);
        		tftlcd_write_index_register(TS_INS_GAMMA_CTRL8);
        		tftlcd_write_wdr(0x0007);
        		tftlcd_write_index_register(TS_INS_GAMMA_CTRL9);
        		tftlcd_write_wdr(0x0602);
        		tftlcd_write_index_register(TS_INS_GAMMA_CTRL10);
        		tftlcd_write_wdr(0x0808);
        
        		tftlcd_write_index_register(TS_INS_HOR_START_AD);
        		tftlcd_write_wdr(0x0000);
        		tftlcd_write_index_register(TS_INS_HOR_END_AD);
        		tftlcd_write_wdr(0x00EF);
        		tftlcd_write_index_register(TS_INS_VER_START_AD);
        		tftlcd_write_wdr(0x0000);
        		tftlcd_write_index_register(TS_INS_VER_END_AD);
        		tftlcd_write_wdr(0x013F);
        		tftlcd_write_index_register(TS_INS_GATE_SCAN_CTRL1);
        		tftlcd_write_wdr(0xA700);
        		tftlcd_write_index_register(TS_INS_GATE_SCAN_CTRL2);
        		tftlcd_write_wdr(0x0001);
        		tftlcd_write_index_register(TS_INS_GATE_SCAN_CTRL3);
        		tftlcd_write_wdr(0x0000);
        
        		tftlcd_write_index_register(TS_INS_PART_IMG1_DISP_POS);
        		tftlcd_write_wdr(0x0000);
        		tftlcd_write_index_register(TS_INS_PART_IMG1_START_AD);
        		tftlcd_write_wdr(0x0000);
        		tftlcd_write_index_register(TS_INS_PART_IMG1_END_AD);
        		tftlcd_write_wdr(0x0000);
        		tftlcd_write_index_register(TS_INS_PART_IMG2_DISP_POS);
        		tftlcd_write_wdr(0x0000);
        		tftlcd_write_index_register(TS_INS_PART_IMG2_START_AD);
        		tftlcd_write_wdr(0x0000);
        		tftlcd_write_index_register(TS_INS_PART_IMG2_END_AD);
        		tftlcd_write_wdr(0x0000);
        
        		tftlcd_write_index_register(TS_INS_PANEL_IF_CTRL1);
        		tftlcd_write_wdr(0x0010);
        		tftlcd_write_index_register(TS_INS_PANEL_IF_CTRL2);
        		tftlcd_write_wdr(0x0000);
        		tftlcd_write_index_register(TS_INS_PANEL_IF_CTRL3);
        		tftlcd_write_wdr(0x0003);
        		tftlcd_write_index_register(TS_INS_PANEL_IF_CTRL4);
        		tftlcd_write_wdr(0x0110);
        		tftlcd_write_index_register(TS_INS_PANEL_IF_CTRL5);
        		tftlcd_write_wdr(0x0000);
        		tftlcd_write_index_register(TS_INS_PANEL_IF_CTRL6);
        		tftlcd_write_wdr(0x0000);
        
        		tftlcd_write_index_register(TS_INS_DISP_CTRL1);
        		tftlcd_write_wdr(0x0133);
        
        	tftlcd_clear(0xffff);
        	}
        //****************************************************************
        void tftlcd_write_pixel(int x,int y,int color)
          {
        	if(x < 0) x = 0;
        	if(y < 0) y = 0;
        	if(x > 239) x = 239;
        	if(y > 319) y = 319;
        
        
        	tftlcd_write_index_register(TS_INS_START_ADX);
          tftlcd_write_wdr(x);
          tftlcd_write_index_register(TS_INS_END_ADX);
          tftlcd_write_wdr(x);
          tftlcd_write_index_register(TS_INS_GRAM_ADX);
          tftlcd_write_wdr(x);
        
        	y = 319 - y;
        	y = 319 - y;
          tftlcd_write_index_register(TS_INS_START_ADY);
          tftlcd_write_wdr(y);
          tftlcd_write_index_register(TS_INS_END_ADY);
          tftlcd_write_wdr(y);
        	tftlcd_write_index_register(TS_INS_GRAM_ADY);
          tftlcd_write_wdr(y);
        
          tftlcd_write_index_register(TS_INS_RW_GRAM);
        
        	tftlcd_write_wdr(color);
          }
        
        //-----------------------------------------------------------------------
        // Show A Picture On The LCD Screen
        //-----------------------------------------------------------------------
        void tftlcd_write_pic(int x,int y,const unsigned short *pointer)
           {
        		int counter;
        
        
        
        	  tftlcd_write_index_register(TS_INS_START_ADX);
        	  tftlcd_write_wdr(0);
        	  tftlcd_write_index_register(TS_INS_END_ADX);
        	  tftlcd_write_wdr(239);
        	  tftlcd_write_index_register(TS_INS_GRAM_ADX);
        	  tftlcd_write_wdr(0);
        	  tftlcd_write_index_register(TS_INS_START_ADY);
        	  tftlcd_write_wdr(0);
        	  tftlcd_write_index_register(TS_INS_END_ADY);
        	  tftlcd_write_wdr(319);
        		tftlcd_write_index_register(TS_INS_GRAM_ADY);
        	  tftlcd_write_wdr(319);
        
        	  tftlcd_write_index_register(TS_INS_RW_GRAM);
        
        
        	  for(counter = 0;counter < 76800;counter++)
        	    tftlcd_write_wdr(pointer[counter]);
        
        
        
           }
        
        
        #endif
        فعلا قسمت عکس رو بیخیال شو و فعلا تو مین این رو بنویس.
        ببین صفحه قرمز میشه.

        کد:
        int main(void){
        
        LPC_GPIO1->FIODIR=0xffffffff;
        
        delay_ms(10);
        tftlcd_init();
         while(1) {
        	 tftlcd_clear(RED);
         }
        }
        تولید کننده انواع تابلو فرمان آسانسور با تکنولوژی روز دنیا

        دیدگاه


          #5
          پاسخ : راه اندازی ال سی دی ان 96 با میکرو lpc1768

          نوشته اصلی توسط mehdi_nxp
          شما این هدر رو به پروژه اضافه کن.
          پایه های کنترلی که اول هدر مشخصه که باید به کجا وصل بشن.
          پایه های دیتا هم از پایه 14 پورت 1 شروع میشن تا 29.

          کد:
          #ifndef _TFTLCD_FUNCTIONS_H_
          #define _TFTLCD_FUNCTIONS_H_
          
          
          #define TFTLCD_RST_LOW         LPC_GPIO1->FIOCLR=1<<10;
          #define TFTLCD_RST_HIGH        LPC_GPIO1->FIOSET=1<<10;
          #define TFTLCD_RS_LOW         LPC_GPIO1->FIOCLR=1<<8;
          #define TFTLCD_RS_HIGH         LPC_GPIO1->FIOSET=1<<8;
          #define TFTLCD_CS_LOW         LPC_GPIO1->FIOCLR=1<<9;
          #define TFTLCD_CS_HIGH         LPC_GPIO1->FIOSET=1<<9;
          #define TFTLCD_RD_LOW         LPC_GPIO1->FIOCLR=1<<1;
          #define TFTLCD_RD_HIGH         LPC_GPIO1->FIOSET=1<<1;
          #define TFTLCD_WR_LOW         LPC_GPIO1->FIOCLR=1<<4;
          #define TFTLCD_WR_HIGH         LPC_GPIO1->FIOSET=1<<4;
          
          /* LCD Command Codes */
          #define TS_INS_START_OSC      0x00
          #define TS_INS_DRIV_OUT_CTRL    0x01
          #define TS_INS_DRIV_WAV_CTRL    0x02
          #define TS_INS_ENTRY_MOD      0x03
          #define TS_INS_RESIZE_CTRL     0x04
          #define TS_INS_DISP_CTRL1      0x07
          #define TS_INS_DISP_CTRL2      0x08
          #define TS_INS_DISP_CTRL3      0x09
          #define TS_INS_DISP_CTRL4      0x0A
          #define TS_INS_RGB_DISP_IF_CTRL1  0x0C
          #define TS_INS_FRM_MARKER_POS    0x0D
          #define TS_INS_RGB_DISP_IF_CTRL2  0x0F
          #define TS_INS_POW_CTRL1      0x10
          #define TS_INS_POW_CTRL2      0x11
          #define TS_INS_POW_CTRL3      0x12
          #define TS_INS_POW_CTRL4      0x13
          #define TS_INS_GRAM_HOR_AD     0x20
          #define TS_INS_GRAM_VER_AD     0x21
          #define TS_INS_RW_GRAM       0x22
          #define TS_INS_POW_CTRL7      0x29
          #define TS_INS_FRM_RATE_COL_CTRL  0x2B
          #define TS_INS_GAMMA_CTRL1     0x30
          #define TS_INS_GAMMA_CTRL2     0x31
          #define TS_INS_GAMMA_CTRL3     0x32
          #define TS_INS_GAMMA_CTRL4     0x35 
          #define TS_INS_GAMMA_CTRL5     0x36
          #define TS_INS_GAMMA_CTRL6     0x37
          #define TS_INS_GAMMA_CTRL7     0x38
          #define TS_INS_GAMMA_CTRL8     0x39
          #define TS_INS_GAMMA_CTRL9     0x3C
          #define TS_INS_GAMMA_CTRL10     0x3D
          #define TS_INS_HOR_START_AD     0x50
          #define TS_INS_HOR_END_AD      0x51
          #define TS_INS_VER_START_AD     0x52
          #define TS_INS_VER_END_AD      0x53
          #define TS_INS_GATE_SCAN_CTRL1   0x60
          #define TS_INS_GATE_SCAN_CTRL2   0x61
          #define TS_INS_GATE_SCAN_CTRL3   0x6A
          #define TS_INS_PART_IMG1_DISP_POS  0x80
          #define TS_INS_PART_IMG1_START_AD  0x81
          #define TS_INS_PART_IMG1_END_AD   0x82
          #define TS_INS_PART_IMG2_DISP_POS  0x83
          #define TS_INS_PART_IMG2_START_AD  0x84
          #define TS_INS_PART_IMG2_END_AD   0x85
          #define TS_INS_PANEL_IF_CTRL1    0x90
          #define TS_INS_PANEL_IF_CTRL2    0x92
          #define TS_INS_PANEL_IF_CTRL3    0x93
          #define TS_INS_PANEL_IF_CTRL4    0x95
          #define TS_INS_PANEL_IF_CTRL5    0x97
          #define TS_INS_PANEL_IF_CTRL6    0x98      
          
          #define TS_SIZE_X          240
          #define TS_SIZE_Y          320
          #define TS_VAL_ENTRY_MOD      0x0030
          #define TS_INS_GRAM_ADX       TS_INS_GRAM_HOR_AD
          #define TS_INS_GRAM_ADY       TS_INS_GRAM_VER_AD
          #define TS_INS_START_ADX      TS_INS_HOR_START_AD
          #define TS_INS_END_ADX       TS_INS_HOR_END_AD
          #define TS_INS_START_ADY      TS_INS_VER_START_AD
          #define TS_INS_END_ADY       TS_INS_VER_END_AD
          
          
          #define RED             0x001F
          #define GREEN            0x07E0
          #define BLUE            0xF800
          #define YELLOW           0x07FF
          #define PURPLE           0xF81F
          #define BLACK            0x0000
          #define WHITE            0xFFFF
          
          #define HIGH 1
          #define LOW 0
          
          
          //***************************************************************
          void tftlcd_write_index_register(int command)
          	{
          	TFTLCD_RS_LOW;
          	LPC_GPIO1->FIOCLR=0xffff<<14;
          	LPC_GPIO1->FIOSET=command<<14;
          	TFTLCD_CS_LOW;
          	TFTLCD_CS_HIGH;
          	LPC_GPIO1->FIOCLR=0xffff<<14;
          	TFTLCD_RS_HIGH;
          	}
          //***************************************************************
          void tftlcd_write_wdr(int data)
          	{
          	LPC_GPIO1->FIOCLR=0xffff<<14;
          	LPC_GPIO1->FIOSET=data<<14;
          	TFTLCD_CS_LOW;
            TFTLCD_CS_HIGH;
          	}
          //***************************************************************
          void tftlcd_write_command(int index,int argument)
          	{
          	tftlcd_write_index_register(index);
          	tftlcd_write_wdr(argument);
          	}
          //***************************************************************
          void tftlcd_clear(int co)
          	{
          	int counter;
          
            tftlcd_write_index_register(TS_INS_START_ADX);
            tftlcd_write_wdr(0);
            tftlcd_write_index_register(TS_INS_END_ADX);
            tftlcd_write_wdr(239);
            tftlcd_write_index_register(TS_INS_GRAM_ADX);
            tftlcd_write_wdr(0);
            tftlcd_write_index_register(TS_INS_START_ADY);
            tftlcd_write_wdr(0);
            tftlcd_write_index_register(TS_INS_END_ADY);
            tftlcd_write_wdr(319);
          	tftlcd_write_index_register(TS_INS_GRAM_ADY);
            tftlcd_write_wdr(319);
          
            tftlcd_write_index_register(TS_INS_RW_GRAM);
          
            for(counter = 0;counter < 76800;counter++)
              tftlcd_write_wdr(co);
          	}
          //***************************************************************
          void tftlcd_init(void)
          	{
          	TFTLCD_RST_HIGH;
          	TFTLCD_CS_HIGH;
          	TFTLCD_RD_HIGH;
          	TFTLCD_WR_LOW;
            // Reset LCD Chipset
            TFTLCD_RST_LOW;
            delay_ms(50);
            TFTLCD_RST_HIGH;
            delay_ms(50);
          
          		tftlcd_write_index_register(0x00E3);
          		tftlcd_write_wdr(0x3008); 					//set the internal timing
          		tftlcd_write_index_register(0x00E7);
          		tftlcd_write_wdr(0x0012); 					//set the internal timing
          		tftlcd_write_index_register(0x00EF);
          		tftlcd_write_wdr(0x1231); 					//set the internal timing
          		tftlcd_write_index_register(TS_INS_START_OSC);
          		tftlcd_write_wdr(0x0001); 					//start oscillator
          		delay_ms(50);
          
          		tftlcd_write_index_register(TS_INS_DRIV_OUT_CTRL);
          		tftlcd_write_wdr(0x0000); 					//set SS, SM
          		tftlcd_write_index_register(TS_INS_DRIV_WAV_CTRL);
          		tftlcd_write_wdr(0x0700); 					//set 1 line inversion
          
          		tftlcd_write_index_register(TS_INS_ENTRY_MOD);
          		tftlcd_write_wdr(TS_VAL_ENTRY_MOD);			//set GRAM write direction, BGR=0
          
          		tftlcd_write_index_register(TS_INS_RESIZE_CTRL);
          		tftlcd_write_wdr(0x0000); 					//no resizing
          
          		tftlcd_write_index_register(TS_INS_DISP_CTRL2);
          		tftlcd_write_wdr(0x0202); 					//front & back porch periods = 2
          		tftlcd_write_index_register(TS_INS_DISP_CTRL3);
          		tftlcd_write_wdr(0x0000);
          		tftlcd_write_index_register(TS_INS_DISP_CTRL4);
          		tftlcd_write_wdr(0x0000);
          		tftlcd_write_index_register(TS_INS_RGB_DISP_IF_CTRL1);
          		tftlcd_write_wdr(0x0000); 					//select system interface
          		tftlcd_write_index_register(TS_INS_FRM_MARKER_POS);
          		tftlcd_write_wdr(0x0000);
          		tftlcd_write_index_register(TS_INS_RGB_DISP_IF_CTRL2);
          		tftlcd_write_wdr(0x0000);
          
          		tftlcd_write_index_register(TS_INS_POW_CTRL1);
          		tftlcd_write_wdr(0x0000);
          		tftlcd_write_index_register(TS_INS_POW_CTRL2);
          		tftlcd_write_wdr(0x0007);
          		tftlcd_write_index_register(TS_INS_POW_CTRL3);
          		tftlcd_write_wdr(0x0000);
          		tftlcd_write_index_register(TS_INS_POW_CTRL4);
          		tftlcd_write_wdr(0x0000);
          		delay_ms(200);
          
          		tftlcd_write_index_register(TS_INS_POW_CTRL1);
          		tftlcd_write_wdr(0x1690);
          		tftlcd_write_index_register(TS_INS_POW_CTRL2);
          		tftlcd_write_wdr(0x0227); //tftlcd_write_wdr(0x0137);
          		delay_ms(50);
          
          		tftlcd_write_index_register(TS_INS_POW_CTRL3);
          		tftlcd_write_wdr(0x001A); //tftlcd_write_wdr(0x013C);
          		delay_ms(50);
          
          		tftlcd_write_index_register(TS_INS_POW_CTRL4);
          		tftlcd_write_wdr(0x1800); //tftlcd_write_wdr(0x1400);
          		tftlcd_write_index_register(TS_INS_POW_CTRL7);
          		tftlcd_write_wdr(0x002A); //tftlcd_write_wdr(0x0007);
          		delay_ms(50);
          
          		tftlcd_write_index_register(TS_INS_GRAM_HOR_AD);
          		tftlcd_write_wdr(0x0000);
          		tftlcd_write_index_register(TS_INS_GRAM_VER_AD);
          		tftlcd_write_wdr(0x0000);
          
          		tftlcd_write_index_register(TS_INS_GAMMA_CTRL1);
          		tftlcd_write_wdr(0x0007);
          		tftlcd_write_index_register(TS_INS_GAMMA_CTRL2);
          		tftlcd_write_wdr(0x0605);
          		tftlcd_write_index_register(TS_INS_GAMMA_CTRL3);
          		tftlcd_write_wdr(0x0106);
          		tftlcd_write_index_register(TS_INS_GAMMA_CTRL4);
          		tftlcd_write_wdr(0x0206);
          		tftlcd_write_index_register(TS_INS_GAMMA_CTRL5);
          		tftlcd_write_wdr(0x0808);
          		tftlcd_write_index_register(TS_INS_GAMMA_CTRL6);
          		tftlcd_write_wdr(0x0007);
          		tftlcd_write_index_register(TS_INS_GAMMA_CTRL7);
          		tftlcd_write_wdr(0x0201);
          		tftlcd_write_index_register(TS_INS_GAMMA_CTRL8);
          		tftlcd_write_wdr(0x0007);
          		tftlcd_write_index_register(TS_INS_GAMMA_CTRL9);
          		tftlcd_write_wdr(0x0602);
          		tftlcd_write_index_register(TS_INS_GAMMA_CTRL10);
          		tftlcd_write_wdr(0x0808);
          
          		tftlcd_write_index_register(TS_INS_HOR_START_AD);
          		tftlcd_write_wdr(0x0000);
          		tftlcd_write_index_register(TS_INS_HOR_END_AD);
          		tftlcd_write_wdr(0x00EF);
          		tftlcd_write_index_register(TS_INS_VER_START_AD);
          		tftlcd_write_wdr(0x0000);
          		tftlcd_write_index_register(TS_INS_VER_END_AD);
          		tftlcd_write_wdr(0x013F);
          		tftlcd_write_index_register(TS_INS_GATE_SCAN_CTRL1);
          		tftlcd_write_wdr(0xA700);
          		tftlcd_write_index_register(TS_INS_GATE_SCAN_CTRL2);
          		tftlcd_write_wdr(0x0001);
          		tftlcd_write_index_register(TS_INS_GATE_SCAN_CTRL3);
          		tftlcd_write_wdr(0x0000);
          
          		tftlcd_write_index_register(TS_INS_PART_IMG1_DISP_POS);
          		tftlcd_write_wdr(0x0000);
          		tftlcd_write_index_register(TS_INS_PART_IMG1_START_AD);
          		tftlcd_write_wdr(0x0000);
          		tftlcd_write_index_register(TS_INS_PART_IMG1_END_AD);
          		tftlcd_write_wdr(0x0000);
          		tftlcd_write_index_register(TS_INS_PART_IMG2_DISP_POS);
          		tftlcd_write_wdr(0x0000);
          		tftlcd_write_index_register(TS_INS_PART_IMG2_START_AD);
          		tftlcd_write_wdr(0x0000);
          		tftlcd_write_index_register(TS_INS_PART_IMG2_END_AD);
          		tftlcd_write_wdr(0x0000);
          
          		tftlcd_write_index_register(TS_INS_PANEL_IF_CTRL1);
          		tftlcd_write_wdr(0x0010);
          		tftlcd_write_index_register(TS_INS_PANEL_IF_CTRL2);
          		tftlcd_write_wdr(0x0000);
          		tftlcd_write_index_register(TS_INS_PANEL_IF_CTRL3);
          		tftlcd_write_wdr(0x0003);
          		tftlcd_write_index_register(TS_INS_PANEL_IF_CTRL4);
          		tftlcd_write_wdr(0x0110);
          		tftlcd_write_index_register(TS_INS_PANEL_IF_CTRL5);
          		tftlcd_write_wdr(0x0000);
          		tftlcd_write_index_register(TS_INS_PANEL_IF_CTRL6);
          		tftlcd_write_wdr(0x0000);
          
          		tftlcd_write_index_register(TS_INS_DISP_CTRL1);
          		tftlcd_write_wdr(0x0133);
          
          	tftlcd_clear(0xffff);
          	}
          //****************************************************************
          void tftlcd_write_pixel(int x,int y,int color)
            {
          	if(x < 0) x = 0;
          	if(y < 0) y = 0;
          	if(x > 239) x = 239;
          	if(y > 319) y = 319;
          
          
          	tftlcd_write_index_register(TS_INS_START_ADX);
            tftlcd_write_wdr(x);
            tftlcd_write_index_register(TS_INS_END_ADX);
            tftlcd_write_wdr(x);
            tftlcd_write_index_register(TS_INS_GRAM_ADX);
            tftlcd_write_wdr(x);
          
          	y = 319 - y;
          	y = 319 - y;
            tftlcd_write_index_register(TS_INS_START_ADY);
            tftlcd_write_wdr(y);
            tftlcd_write_index_register(TS_INS_END_ADY);
            tftlcd_write_wdr(y);
          	tftlcd_write_index_register(TS_INS_GRAM_ADY);
            tftlcd_write_wdr(y);
          
            tftlcd_write_index_register(TS_INS_RW_GRAM);
          
          	tftlcd_write_wdr(color);
            }
          
          //-----------------------------------------------------------------------
          // Show A Picture On The LCD Screen
          //-----------------------------------------------------------------------
          void tftlcd_write_pic(int x,int y,const unsigned short *pointer)
             {
          		int counter;
          
          
          
          	  tftlcd_write_index_register(TS_INS_START_ADX);
          	  tftlcd_write_wdr(0);
          	  tftlcd_write_index_register(TS_INS_END_ADX);
          	  tftlcd_write_wdr(239);
          	  tftlcd_write_index_register(TS_INS_GRAM_ADX);
          	  tftlcd_write_wdr(0);
          	  tftlcd_write_index_register(TS_INS_START_ADY);
          	  tftlcd_write_wdr(0);
          	  tftlcd_write_index_register(TS_INS_END_ADY);
          	  tftlcd_write_wdr(319);
          		tftlcd_write_index_register(TS_INS_GRAM_ADY);
          	  tftlcd_write_wdr(319);
          
          	  tftlcd_write_index_register(TS_INS_RW_GRAM);
          
          
          	  for(counter = 0;counter < 76800;counter++)
          	    tftlcd_write_wdr(pointer[counter]);
          
          
          
             }
          
          
          #endif
          فعلا قسمت عکس رو بیخیال شو و فعلا تو مین این رو بنویس.
          ببین صفحه قرمز میشه.

          کد:
          int main(void){
          
          LPC_GPIO1->FIODIR=0xffffffff;
          
          delay_ms(10);
          tftlcd_init();
           while(1) {
          	 tftlcd_clear(RED);
           }
          }



          بازم خطا میده،میگه تابع تاخیر میلی ثانیه تعریف نشده.
          امکان داره فایل پروژه ای که خودتون اجرا کردید را قراردهید.مرسی
          راه را راهبر قرار مده،بلکه راهي ناپيموده را آغاز کن و از خود راهي بر جاي بگذار.

          دیدگاه


            #6
            پاسخ : راه اندازی ال سی دی ان 96 با میکرو lpc1768

            من با کمپایلر CoIDE کار میکنم.
            اگه کارتون راه میوفته که بدم.
            اون تابع میلی ثانیه هم خوب میشه این جوری دیگه.
            هرچند دقیق نیست ولی کار راه اندازه.
            کد:
            void delay_ms(int t){
             for(t=t*10000;t>0;t--);
            }
            تولید کننده انواع تابلو فرمان آسانسور با تکنولوژی روز دنیا

            دیدگاه


              #7
              پاسخ : راه اندازی ال سی دی ان 96 با میکرو lpc1768

              سلام
              این برای ال سی دی 3.2 اینچی هم جواب میده؟
              [glow=red,2,300]برنامه هاي آموزشي تست شده براي NXP LPC1768 با توابع CMSIS[/glow]
              http://www.eca.ir/forum2/index.php?topic=76623.0

              دیدگاه


                #8
                پاسخ : راه اندازی ال سی دی ان 96 با میکرو lpc1768

                نوشته اصلی توسط Reza Sede
                سلام
                این برای ال سی دی 3.2 اینچی هم جواب میده؟
                سلام.
                با 3.2 اینچ تا حالا کار نکردم ولی اینجا کد براش هست.
                تولید کننده انواع تابلو فرمان آسانسور با تکنولوژی روز دنیا

                دیدگاه

                لطفا صبر کنید...
                X