Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

JHD 161A lcd interfacing with LPC 2129

Status
Not open for further replies.

saidutt

Member level 2
Joined
Dec 4, 2009
Messages
43
Helped
6
Reputation
12
Reaction score
4
Trophy points
1,288
Location
india
Activity points
1,592
hi,
i am new to ARM .
i have t o interface to LCD with LPC2129.
i have written the code. LCD is not displaying.

Code:
		#include<lpc21xx.h>
			unsigned int rs=0x00000010;
			unsigned int rw=0x00000020;
			unsigned int e=0x00000040;
		void MSDelay(unsigned int itime)   //delay function 
			{ 
			   unsigned int i,j; 
			   for(i=0;i<itime;i++) 
			   for(j=0x00;j<0x00FFFFF;j++); 
			}
			void lcd_cmd(unsigned int d)
			{	
				IOPIN1=d;
				IOSET1=d;
				IOCLR0=rs;
				IOCLR0=rw;
		    
			 	IOSET0=e;
				MSDelay(1); 
				IOCLR0=e;
				 
			}
			void lcd_data(unsigned int d)
			{
			 d<<=16;
			  IOPIN1=d;
			 IOSET1=d;
			 IOSET0=rs;
			 IOCLR0=rw;
			
			 IOSET0=e;
			 MSDelay(1);
			 IOCLR0=e;
			  

			}
			void lcd_init()
			{
				
				lcd_cmd(0x00300000);
		//	MSDelay(25); 
				lcd_cmd(0x000C0000);
		//	MSDelay(25); 
				lcd_cmd(0x00060000);
		//	MSDelay(25); 
				lcd_cmd(0x000E0000);
		//	MSDelay(25); 
				lcd_cmd(0x00800000);
		//	MSDelay(25); 
			}
			int main(void)
			{
				PINSEL0&=0xFFFFFF00;
					PINSEL2&=0x00000000;
				IODIR0&=0xFFFFFFFF;
				IODIR1&=0xFFFF0000;
		
			 
			  {
			  	  lcd_init();
			   lcd_data('a');
			   MSDelay(1); 
			  // 	lcd_cmd(0x00060000);
			   lcd_data('s');
			   MSDelay(1); 
			  // 	lcd_cmd(0x00060000);
			   lcd_data('i');
			  MSDelay(1); 
			 //  	lcd_cmd(0x00060000);
			   }
			    while(1);
			 return 0;
			}


please help me out

thank you
 

Most of the time the problem is with initializing.

Check out the timings (your delay is commented on your code)

what does the lcd shows

Nandhu
 

    saidutt

    Points: 2
    Helpful Answer Positive Rating
nandhu015 said:
Most of the time the problem is with initializing.

Check out the timings (your delay is commented on your code)

what does the lcd shows

Nandhu

hi friend,

thank you for the reply.

LCD display square boxes only.

even i tried to reduce PCLK to 10M Hz.
because LCD runs at Lesser frequency and where as ARM 7 runs at higher frequency.

please help me out with this issue.
 

saidutt said:
hi,
i am new to ARM .
i have t o interface to LCD with LPC2129.
i have written the code. LCD is not displaying.

Code:
		#include<lpc21xx.h>
			unsigned int rs=0x00000010;
			unsigned int rw=0x00000020;
			unsigned int e=0x00000040;
		void MSDelay(unsigned int itime)   //delay function 
			{ 
			   unsigned int i,j; 
			   for(i=0;i<itime;i++) 
			   for(j=0x00;j<0x00FFFFF;j++); 
			}
			void lcd_cmd(unsigned int d)
			{	
				IOPIN1=d;
				IOSET1=d;
				IOCLR0=rs;
				IOCLR0=rw;
		    
			 	IOSET0=e;
				MSDelay(1); 
				IOCLR0=e;
				 
			}
			void lcd_data(unsigned int d)
			{
			 d<<=16;
			  IOPIN1=d;
			 IOSET1=d;
			 IOSET0=rs;
			 IOCLR0=rw;
			
			 IOSET0=e;
			 MSDelay(1);
			 IOCLR0=e;
			  

			}
			void lcd_init()
			{
				
				lcd_cmd(0x00300000);
		//	MSDelay(25); 
				lcd_cmd(0x000C0000);
		//	MSDelay(25); 
				lcd_cmd(0x00060000);
		//	MSDelay(25); 
				lcd_cmd(0x000E0000);
		//	MSDelay(25); 
				lcd_cmd(0x00800000);
		//	MSDelay(25); 
			}
			int main(void)
			{
				PINSEL0&=0xFFFFFF00;
					PINSEL2&=0x00000000;
				IODIR0&=0xFFFFFFFF;
				IODIR1&=0xFFFF0000;
		
			 
			  {
			  	  lcd_init();
			   lcd_data('a');
			   MSDelay(1); 
			  // 	lcd_cmd(0x00060000);
			   lcd_data('s');
			   MSDelay(1); 
			  // 	lcd_cmd(0x00060000);
			   lcd_data('i');
			  MSDelay(1); 
			 //  	lcd_cmd(0x00060000);
			   }
			    while(1);
			 return 0;
			}


please help me out

thank you
can you try this patch
Code:
      #include<lpc21xx.h>
         unsigned int rs=0x00000010;
         unsigned int rw=0x00000020;
         unsigned int e=0x00000040;
      void MSDelay(unsigned int itime)   //delay function
         {
            unsigned int i,j;
            for(i=0;i<itime;i++)
            for(j=0x00;j<0x00FFFFF;j++);
         }
         void lcd_cmd(unsigned int d)
         {   
            IOPIN1=d;
            IOSET1=d;
            IOCLR0=rs;
            IOCLR0=rw;
         
             IOSET0=e;
            MSDelay(50);
            IOCLR0=e;
            
         }
         void lcd_data(unsigned int d)
         {
          d<<=16;
           IOPIN1=d;
          IOSET1=d;
          IOSET0=rs;
          IOCLR0=rw;
         
          IOSET0=e;
          MSDelay(50);
          IOCLR0=e;
          

         }
         void lcd_init()
         {
            
            lcd_cmd(0x00300000);
      //   MSDelay(500);
            lcd_cmd(0x000C0000);
      //   MSDelay(500);
            lcd_cmd(0x00060000);
      //   MSDelay(500);
            lcd_cmd(0x000E0000);
      //   MSDelay(500);
            lcd_cmd(0x00800000);
      //   MSDelay(500);
         }
         int main(void)
         {
            PINSEL0&=0xFFFFFF00;
               PINSEL2&=0x00000000;
            IODIR0&=0xFFFFFFFF;
            IODIR1&=0xFFFF0000;
      
         
           {
                lcd_init();
            lcd_data('a');
            MSDelay(50);
           //    lcd_cmd(0x00060000);
            lcd_data('s');
            MSDelay(50);
           //    lcd_cmd(0x00060000);
            lcd_data('i');
           MSDelay(50);
          //     lcd_cmd(0x00060000);
            }
             while(1);
          return 0;
         }
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top