Yahoo Groups archive

Lpc2000

Index last updated: 2026-04-28 23:31 UTC

Thread

code problems when connecting ARMs and TFT LCD screens

code problems when connecting ARMs and TFT LCD screens

2006-03-29 by thal_munki

I am attempting to link an ARM microcontroller (LPC2103) and a color 
TFT LCD screen (LP104V2 , 640x480 , TTL interface). The screen's 
datasheet is found here: www.larwe.com/technical/datasheets/lp104v2-w.
pdf 
The code I'm using to run the screen is shown below 


Code:	


#include <targets/LPC210x.h> 

//--------------------------------------------------------------------
------ 
long pixel_number=0;        //Horizontal position of scan 
long row_number=0;          //Verical position of scan 
long delay_variable=0; 
#define DCLK    0x00000004      //P0.2 
#define HSYNC   0x00000008   //P0.3 
#define VSYNC   0x00000010   //P0.4 
#define DTMG    0x00000020   //P0.5 
#define DATA    0x00000040   //P0.6 (This is blue data only) 
#define button  0x00008000      //P0.15 
//--------------------------------------------------------------------
------ 


static void 
ledInit() 
{ 
  IODIR |= 0x04000000; 
  IOSET = 0x04000000; 
} 

static void 
ledOn(void) 
{ 
  IOCLR = 0x04000000; 
} 

static void 
ledOff(void) 
{ 
  IOSET = 0x04000000; 
} 

void 
delay(int d) 
{      
  for(; d; --d); 
} 
//--------------------------------------------------------------------

void LCD_config(void){      //Configure GPIO for LP104v2 
      
        IODIR=0xFF;   //P0.0 : P0.7 set to outputs 
   IOCLR=0x00;   //P0.0 : P0.7 LOW 
   pixel_number=0; 
   row_number=0; 
   IOSET=HSYNC;   //H sync high 
   IOSET=VSYNC;   //V sync high 
        IOSET=DATA;     //Data high 
} 
    
void LCD_page(void){        //Scan a page into LP104v2 
    IOCLR=VSYNC;       //Lower V sync 
    for(delay_variable=0; delay_variable<3397; delay_variable++); 
                            //64uS delay 
    IOSET=VSYNC;       //V sync high 
    for(delay_variable=0; delay_variable<554347; delay_variable++); 
                        //1.02mS delay 
    do{ 
        IOCLR=HSYNC;   //Lower H sync 
        for(delay_variable=0; delay_variable<200; delay_variable++); 
                            //3.77uS delay 
        IOSET=HSYNC;   //H sync high 
        for(delay_variable=0; delay_variable<100; delay_variable++); 
                            //1.89uS delay 
        IOSET=DTMG;    //DTMG high 
        do{ 
            IOSET=DCLK;    //Data clock high 
            
            IOCLR=DCLK;    //Data clock low 
            pixel_number++; //Increment pixel count 
        } while (pixel_number<639); 
        pixel_number=0; 
        for(delay_variable=0; delay_variable<49; delay_variable++); 
                            //0.94uS delay 
        row_number++;  //Increment line number 
    } while (row_number<478); 
    for(delay_variable=0; delay_variable<190217; delay_variable); 
                            //0.35mS delay 
    row_number=0;  //Reset line counter 
} 



//--------------------------------------------------------------------
------ 
int 
main(void) 
{ 

  MAMCR = 2; 
  ledInit(); 
  ledOn(); 
  delay(100000);  
  ledOff(); 
  delay(100000); 
  LCD_config(); 
  while (1) 
    { 
    LCD_page(); 
    } 
  return 0; 
} 

	


I attached the data line to the Blue LSB on the LCD screen 
(Theoretically this will produce a dark blue when high). The only 
problem is that this is not happening. Nothing happens. I know the ARM 
is running and the startup code is correct because it flashes the 
status LED as stated in the code, and I know the LCD is functional 
because for a fraction of a second it goes dark (this is not a result 
of the ARM, it happens whenever power is applied to the screen. Where 
have I gone wrong? help, anyone?

Re: code problems when connecting ARMs and TFT LCD screens

2006-03-30 by unity0724

Umm...

This is a panel with LCD glass driver (shift register drivers)
only. For 640x480, the data rate is:
    640(H)*480(V)*50(Refresh rate)=15,360,000
You need to clock data in at 15MHz clock rate for non- 
multiplexed data lines (Color input lines).
Question: Does the LPC2103 has enough speed??

You have to refresh LCD at min 50Hz as the glass panel 
normally keep toggling it's substrate voltage (every VSync).

For testing purpose, May be you can try with... 
(light only 320x240 of the panel, for quick testing) 

- HSync is normally tied to "latch clock" of the shift register
  driver => shift in 320 bits/data and clock it once
- VSync is normally tied to the line decoders and clear control of 
  line counter.  Try Refresh 240 lines first 
  => Toggles every 240 HSync pulses.

Hope it helps. LPC2103 do not have enough power, neither enough
RAM/ROM size to drive the 640x480 LCD directly...
Good luck...
Regards


--- In lpc2000@yahoogroups.com, "thal_munki" <octech@...> wrote:
>
> I am attempting to link an ARM microcontroller (LPC2103) and a 
color 
> TFT LCD screen (LP104V2 , 640x480 , TTL interface). The screen's 
> datasheet is found here: 
www.larwe.com/technical/datasheets/lp104v2-w.
> pdf 
> The code I'm using to run the screen is shown below 
> 
> 
> Code:	
> 
> 
> #include <targets/LPC210x.h> 
> 
> //-----------------------------------------------------------------
---
> ------ 
> long pixel_number=0;        //Horizontal position of scan 
> long row_number=0;          //Verical position of scan 
> long delay_variable=0; 
> #define DCLK    0x00000004      //P0.2 
> #define HSYNC   0x00000008   //P0.3 
> #define VSYNC   0x00000010   //P0.4 
> #define DTMG    0x00000020   //P0.5 
> #define DATA    0x00000040   //P0.6 (This is blue data only) 
> #define button  0x00008000      //P0.15 
> //-----------------------------------------------------------------
---
> ------ 
> 
> 
> static void 
> ledInit() 
> { 
>   IODIR |= 0x04000000; 
>   IOSET = 0x04000000; 
> } 
> 
> static void 
> ledOn(void) 
> { 
>   IOCLR = 0x04000000; 
> } 
> 
> static void 
> ledOff(void) 
> { 
>   IOSET = 0x04000000; 
> } 
> 
> void 
> delay(int d) 
> {      
>   for(; d; --d); 
> } 
> //-----------------------------------------------------------------
---
> 
> void LCD_config(void){      //Configure GPIO for LP104v2 
>       
>         IODIR=0xFF;   //P0.0 : P0.7 set to outputs 
>    IOCLR=0x00;   //P0.0 : P0.7 LOW 
>    pixel_number=0; 
>    row_number=0; 
>    IOSET=HSYNC;   //H sync high 
>    IOSET=VSYNC;   //V sync high 
>         IOSET=DATA;     //Data high 
> } 
>     
> void LCD_page(void){        //Scan a page into LP104v2 
>     IOCLR=VSYNC;       //Lower V sync 
>     for(delay_variable=0; delay_variable<3397; delay_variable++); 
>                             //64uS delay 
>     IOSET=VSYNC;       //V sync high 
>     for(delay_variable=0; delay_variable<554347; 
delay_variable++); 
>                         //1.02mS delay 
>     do{ 
>         IOCLR=HSYNC;   //Lower H sync 
>         for(delay_variable=0; delay_variable<200; 
delay_variable++); 
>                             //3.77uS delay 
>         IOSET=HSYNC;   //H sync high 
>         for(delay_variable=0; delay_variable<100; 
delay_variable++); 
>                             //1.89uS delay 
>         IOSET=DTMG;    //DTMG high 
>         do{ 
>             IOSET=DCLK;    //Data clock high 
>             
>             IOCLR=DCLK;    //Data clock low 
>             pixel_number++; //Increment pixel count 
>         } while (pixel_number<639); 
>         pixel_number=0; 
>         for(delay_variable=0; delay_variable<49; 
delay_variable++); 
>                             //0.94uS delay 
>         row_number++;  //Increment line number 
>     } while (row_number<478); 
>     for(delay_variable=0; delay_variable<190217; delay_variable); 
>                             //0.35mS delay 
>     row_number=0;  //Reset line counter 
> } 
> 
> 
> 
> //-----------------------------------------------------------------
---
> ------ 
> int 
> main(void) 
> { 
> 
>   MAMCR = 2; 
>   ledInit(); 
>   ledOn(); 
>   delay(100000);  
>   ledOff(); 
>   delay(100000); 
>   LCD_config(); 
>   while (1) 
>     { 
>     LCD_page(); 
>     } 
>   return 0; 
> } 
> 
> 	
> 
> 
> I attached the data line to the Blue LSB on the LCD screen 
> (Theoretically this will produce a dark blue when high). The only 
> problem is that this is not happening. Nothing happens. I know the 
ARM 
> is running and the startup code is correct because it flashes the 
> status LED as stated in the code, and I know the LCD is functional 
> because for a fraction of a second it goes dark (this is not a 
result 
> of the ARM, it happens whenever power is applied to the screen. 
Where 
> have I gone wrong? help, anyone?
>

Re: [lpc2000] code problems when connecting ARMs and TFT LCD screens

2006-03-30 by Peter Jakacki

Read page 9 of the lcd data sheet, you will have to satisfy the min and 
max DCLK of 21MHz to 32MHz :-o

You are not even using fast I/O anyway but you won't get that update 
rate in software, certainly not C, you will have to hand craft it in 
assembler. If you are not adept in hardware or assembler you should give 
up now (really).

As always .... RT*M and with this sort of stuff don't even bother unless 
you have a scope handy and know how to use it.

*Peter*


thal_munki wrote:
Show quoted textHide quoted text
> I am attempting to link an ARM microcontroller (LPC2103) and a color 
> TFT LCD screen (LP104V2 , 640x480 , TTL interface). The screen's 
> datasheet is found here: www.larwe.com/technical/datasheets/lp104v2-w.
> pdf 
> The code I'm using to run the screen is shown below 
>
>
> Code:	
>
>
> #include <targets/LPC210x.h> 
>
> //--------------------------------------------------------------------
> ------ 
> long pixel_number=0;        //Horizontal position of scan 
> long row_number=0;          //Verical position of scan 
> long delay_variable=0; 
> #define DCLK    0x00000004      //P0.2 
> #define HSYNC   0x00000008   //P0.3 
> #define VSYNC   0x00000010   //P0.4 
> #define DTMG    0x00000020   //P0.5 
> #define DATA    0x00000040   //P0.6 (This is blue data only) 
> #define button  0x00008000      //P0.15 
> //--------------------------------------------------------------------
> ------ 
>
>
> static void 
> ledInit() 
> { 
>   IODIR |= 0x04000000; 
>   IOSET = 0x04000000; 
> } 
>
> static void 
> ledOn(void) 
> { 
>   IOCLR = 0x04000000; 
> } 
>
> static void 
> ledOff(void) 
> { 
>   IOSET = 0x04000000; 
> } 
>
> void 
> delay(int d) 
> {      
>   for(; d; --d); 
> } 
> //--------------------------------------------------------------------
>
> void LCD_config(void){      //Configure GPIO for LP104v2 
>       
>         IODIR=0xFF;   //P0.0 : P0.7 set to outputs 
>    IOCLR=0x00;   //P0.0 : P0.7 LOW 
>    pixel_number=0; 
>    row_number=0; 
>    IOSET=HSYNC;   //H sync high 
>    IOSET=VSYNC;   //V sync high 
>         IOSET=DATA;     //Data high 
> } 
>     
> void LCD_page(void){        //Scan a page into LP104v2 
>     IOCLR=VSYNC;       //Lower V sync 
>     for(delay_variable=0; delay_variable<3397; delay_variable++); 
>                             //64uS delay 
>     IOSET=VSYNC;       //V sync high 
>     for(delay_variable=0; delay_variable<554347; delay_variable++); 
>                         //1.02mS delay 
>     do{ 
>         IOCLR=HSYNC;   //Lower H sync 
>         for(delay_variable=0; delay_variable<200; delay_variable++); 
>                             //3.77uS delay 
>         IOSET=HSYNC;   //H sync high 
>         for(delay_variable=0; delay_variable<100; delay_variable++); 
>                             //1.89uS delay 
>         IOSET=DTMG;    //DTMG high 
>         do{ 
>             IOSET=DCLK;    //Data clock high 
>             
>             IOCLR=DCLK;    //Data clock low 
>             pixel_number++; //Increment pixel count 
>         } while (pixel_number<639); 
>         pixel_number=0; 
>         for(delay_variable=0; delay_variable<49; delay_variable++); 
>                             //0.94uS delay 
>         row_number++;  //Increment line number 
>     } while (row_number<478); 
>     for(delay_variable=0; delay_variable<190217; delay_variable); 
>                             //0.35mS delay 
>     row_number=0;  //Reset line counter 
> } 
>
>
>
> //--------------------------------------------------------------------
> ------ 
> int 
> main(void) 
> { 
>
>   MAMCR = 2; 
>   ledInit(); 
>   ledOn(); 
>   delay(100000);  
>   ledOff(); 
>   delay(100000); 
>   LCD_config(); 
>   while (1) 
>     { 
>     LCD_page(); 
>     } 
>   return 0; 
> } 
>
> 	
>
>
> I attached the data line to the Blue LSB on the LCD screen 
> (Theoretically this will produce a dark blue when high). The only 
> problem is that this is not happening. Nothing happens. I know the ARM 
> is running and the startup code is correct because it flashes the 
> status LED as stated in the code, and I know the LCD is functional 
> because for a fraction of a second it goes dark (this is not a result 
> of the ARM, it happens whenever power is applied to the screen. Where 
> have I gone wrong? help, anyone?

Re: code problems when connecting ARMs and TFT LCD screens

2006-03-30 by thal_munki

ok, what about this screen http://www.goldmine-elec-products.com/
prodinfo.asp?number=G13752





-- In lpc2000@yahoogroups.com, "unity0724" <unity0724@...> wrote:
>
> Umm...
> 
> This is a panel with LCD glass driver (shift register drivers)
> only. For 640x480, the data rate is:
>     640(H)*480(V)*50(Refresh rate)=15,360,000
> You need to clock data in at 15MHz clock rate for non- 
> multiplexed data lines (Color input lines).
> Question: Does the LPC2103 has enough speed??
> 
> You have to refresh LCD at min 50Hz as the glass panel 
> normally keep toggling it's substrate voltage (every VSync).
> 
> For testing purpose, May be you can try with... 
> (light only 320x240 of the panel, for quick testing) 
> 
> - HSync is normally tied to "latch clock" of the shift register
>   driver => shift in 320 bits/data and clock it once
> - VSync is normally tied to the line decoders and clear control of 
>   line counter.  Try Refresh 240 lines first 
>   => Toggles every 240 HSync pulses.
> 
> Hope it helps. LPC2103 do not have enough power, neither enough
> RAM/ROM size to drive the 640x480 LCD directly...
> Good luck...
> Regards
> 
> 
> --- In lpc2000@yahoogroups.com, "thal_munki" <octech@> wrote:
> >
> > I am attempting to link an ARM microcontroller (LPC2103) and a 
> color 
> > TFT LCD screen (LP104V2 , 640x480 , TTL interface). The screen's 
> > datasheet is found here: 
> www.larwe.com/technical/datasheets/lp104v2-w.
> > pdf 
> > The code I'm using to run the screen is shown below 
> > 
> > 
> > Code:	
> > 
> > 
> > #include <targets/LPC210x.h> 
> > 
> > //----------------------------------------------------------------
-
> ---
> > ------ 
> > long pixel_number=0;        //Horizontal position of scan 
> > long row_number=0;          //Verical position of scan 
> > long delay_variable=0; 
> > #define DCLK    0x00000004      //P0.2 
> > #define HSYNC   0x00000008   //P0.3 
> > #define VSYNC   0x00000010   //P0.4 
> > #define DTMG    0x00000020   //P0.5 
> > #define DATA    0x00000040   //P0.6 (This is blue data only) 
> > #define button  0x00008000      //P0.15 
> > //----------------------------------------------------------------
-
> ---
> > ------ 
> > 
> > 
> > static void 
> > ledInit() 
> > { 
> >   IODIR |= 0x04000000; 
> >   IOSET = 0x04000000; 
> > } 
> > 
> > static void 
> > ledOn(void) 
> > { 
> >   IOCLR = 0x04000000; 
> > } 
> > 
> > static void 
> > ledOff(void) 
> > { 
> >   IOSET = 0x04000000; 
> > } 
> > 
> > void 
> > delay(int d) 
> > {      
> >   for(; d; --d); 
> > } 
> > //----------------------------------------------------------------
-
> ---
> > 
> > void LCD_config(void){      //Configure GPIO for LP104v2 
> >       
> >         IODIR=0xFF;   //P0.0 : P0.7 set to outputs 
> >    IOCLR=0x00;   //P0.0 : P0.7 LOW 
> >    pixel_number=0; 
> >    row_number=0; 
> >    IOSET=HSYNC;   //H sync high 
> >    IOSET=VSYNC;   //V sync high 
> >         IOSET=DATA;     //Data high 
> > } 
> >     
> > void LCD_page(void){        //Scan a page into LP104v2 
> >     IOCLR=VSYNC;       //Lower V sync 
> >     for(delay_variable=0; delay_variable<3397; delay_variable++); 
> >                             //64uS delay 
> >     IOSET=VSYNC;       //V sync high 
> >     for(delay_variable=0; delay_variable<554347; 
> delay_variable++); 
> >                         //1.02mS delay 
> >     do{ 
> >         IOCLR=HSYNC;   //Lower H sync 
> >         for(delay_variable=0; delay_variable<200; 
> delay_variable++); 
> >                             //3.77uS delay 
> >         IOSET=HSYNC;   //H sync high 
> >         for(delay_variable=0; delay_variable<100; 
> delay_variable++); 
> >                             //1.89uS delay 
> >         IOSET=DTMG;    //DTMG high 
> >         do{ 
> >             IOSET=DCLK;    //Data clock high 
> >             
> >             IOCLR=DCLK;    //Data clock low 
> >             pixel_number++; //Increment pixel count 
> >         } while (pixel_number<639); 
> >         pixel_number=0; 
> >         for(delay_variable=0; delay_variable<49; 
> delay_variable++); 
> >                             //0.94uS delay 
> >         row_number++;  //Increment line number 
> >     } while (row_number<478); 
> >     for(delay_variable=0; delay_variable<190217; delay_variable); 
> >                             //0.35mS delay 
> >     row_number=0;  //Reset line counter 
> > } 
> > 
> > 
> > 
> > //----------------------------------------------------------------
-
Show quoted textHide quoted text
> ---
> > ------ 
> > int 
> > main(void) 
> > { 
> > 
> >   MAMCR = 2; 
> >   ledInit(); 
> >   ledOn(); 
> >   delay(100000);  
> >   ledOff(); 
> >   delay(100000); 
> >   LCD_config(); 
> >   while (1) 
> >     { 
> >     LCD_page(); 
> >     } 
> >   return 0; 
> > } 
> > 
> > 	
> > 
> > 
> > I attached the data line to the Blue LSB on the LCD screen 
> > (Theoretically this will produce a dark blue when high). The only 
> > problem is that this is not happening. Nothing happens. I know the 
> ARM 
> > is running and the startup code is correct because it flashes the 
> > status LED as stated in the code, and I know the LCD is functional 
> > because for a fraction of a second it goes dark (this is not a 
> result 
> > of the ARM, it happens whenever power is applied to the screen. 
> Where 
> > have I gone wrong? help, anyone?
> >
>

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.