Forums

code problems when connecting ARMs and TFT LCD screens

Started by thal_munki March 29, 2006
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

//--------------------------------
------
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
IOSETA; //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{
IOSETK; //Data clock high

IOCLRK; //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?

Yahoo! Groups Links

An Engineer's Guide to the LPC2100 Series

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),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 l..., "thal_munki" 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 //-----------------------------
---
> ------
> 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
> IOSETA; //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{
> IOSETK; //Data clock high
>
> IOCLRK; //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?
>

Yahoo! Groups Links
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:
> 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 //--------------------------------
> ------
> 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
> IOSETA; //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{
> IOSETK; //Data clock high
>
> IOCLRK; //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?

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

-- In l..., "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),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 l..., "thal_munki" 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
> >
> > //----------------------------
-
> ---
> > ------
> > 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
> > IOSETA; //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{
> > IOSETK; //Data clock high
> >
> > IOCLRK; //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?
>

Yahoo! Groups Links
i want to know is it possible to use the GPIO as the HSYNC , VSYNC
to latch the data into LCD bit by bit?
--- In l..., "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),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 l..., "thal_munki" 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
> >
> > //---------------------------
--
> ---
> > ------
> > 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
> > IOSETA; //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{
> > IOSETK; //Data clock high
> >
> > IOCLRK; //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?
>