Yahoo Groups archive

Lpc2000

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

Message

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?

Attachments

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.