CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Problem with LCD

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
davey



Joined: 04 May 2006
Posts: 17
Location: Sweden

View user's profile Send private message

Problem with LCD
PostPosted: Tue Jun 06, 2006 12:06 pm     Reply with quote

Hi!

I don�t know if this is a common problem with LCD-displays, but mine is dead Laughing . On startup It only shows one line with black squares and then nothing happens. I�ve tried my code on a LAB-X1 dev-board (http://student.msi.vxu.se:3458/users/dbadt03/labx1sch.pdf) and there it works perfectly. But right now I�m using a homemade card with the same LCD as on the dev-board and nothing works. Here�s a picture of my own card with three PIC16F877A and the LCD connected to the 14-pin bridge in the upper-left corner. The upper PIC is the only one connected to the LCD, so don�t worry about the other two.
http://student.msi.vxu.se:3458/users/dbadt03/lcd_problem.bmp
On the right side of the layout you can see how the LCD is connected on the LAB-X1. I�ve tried to connect my display the same way.

I think my program freezes when it tries to check the busy-flag on the LCD. Why I don�t know.... If you look at the schematic for the dev-board there�s a LED-bridge with resistors that shares PORT-D with the LCD. The resistors are connected to Vdd, so I tried connecting the data-wires on my card to Vdd using eight 470-resistors. But that didn�t work either...

Here�s some bits and pieces from my code concerning the LCD:

Code:
void lcd_waitbusy() //LCD-busy
{
   set_tris_d(0xFF);
   lcd.rs = false;
   lcd.rw = true;
   while(1)
   {
      delay_ms(10);
      if(bit_test(lcd.data,7)==0)
      {
            set_tris_d(0x00);
            lcd.rw = false;
            return;
      }
   }
}

void lcd_control(byte ctrl_in) //For writing to the control-register
{
   lcd_waitbusy();
   lcd.rs=false;
   lcd.rw=false;
   lcd.data = ctrl_in;
   lcd.enable=true;
   delay_ms(10);
   lcd.enable=false;
   delay_ms(10);
   lcd.data = 0x00;
}

void lcd_data(byte data_in)  //For writing to the data-register
{
   lcd_waitbusy();
   lcd.rs=true;
   lcd.rw=false;
   lcd.data=data_in;
   lcd.enable=true;
   delay_ms(10);
   lcd.enable=false;
   delay_ms(10);
   lcd.data = 0x00;
}

//=================== SETUP - LCD =======================
   delay_ms(50);
   lcd_control(0x38);
   delay_ms(500);
   lcd_control(0x06);
   delay_ms(50);
   lcd_control(0x0C);
   delay_ms(50);
   lcd_control(0x01);
   delay_ms(50);
   
   info_lcd();

//=======================================================


Can someone please tell me whats wrong? And don�t tell me to use the CCS-provided LCD-drivers, because I really don�t think that�s the problem here....

/David
rnielsen



Joined: 23 Sep 2003
Posts: 852
Location: Utah

View user's profile Send private message

PostPosted: Tue Jun 06, 2006 4:21 pm     Reply with quote

The display is most likely not getting initialized properly. Either the code is not correct or the connections are wrong. A line of black squares is common for a display that has not been initialized. Check and re-check your connections and then make sure the code is sending the initialization strings properly. You might want to make a kind of break-out box and hook up LED's to each pin. Then, step through each command that sends data to the display. This might help you see if the correct strings are getting to the display.

Ronald
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group