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 support@ccsinfo.com

LCD Init problem I changed my Xtal speed from 3.68mhz to 25

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



Joined: 21 Sep 2005
Posts: 12

View user's profile Send private message Yahoo Messenger

LCD Init problem I changed my Xtal speed from 3.68mhz to 25
PostPosted: Fri May 19, 2006 6:37 am     Reply with quote

I researched this in the forum and tried removing the tris, removing the fast IO, and still have the same issue. The display comes up blank or two rows of squares. After I reset the unit multiple times I can get it to come up correctly. I am using a Datamodul Display 4 lines 20 characters each. I am at a lose... I know the processor is working because the USB is echoing my data in hyperterminal. The processor is Microschip pic18lf8722. Complier is 3.249.
Code:

#define lcd_rs                pin_b0      // O lcd register select control line
#define lcd_rw                pin_b1      // O lcd read/write
#define lcd_en               pin_b2      // O lcd enable control line

#define lcd_data_4            pin_J4      // O lcd data pin
#define lcd_data_5            pin_J5      // O lcd data pin
#define lcd_data_6            pin_J6      // O lcd data pin
#define lcd_data_7            pin_J7      // O lcd data pin
#define lcd_busy            pin_J7      // I lcd busy

void LCDInit()
   {
   output_bit(lcd_data_4,0);
   output_bit(lcd_data_5,0);
   output_bit(lcd_data_6,0);
   output_bit(lcd_data_7,0);
   output_bit(lcd_rs,0);
   output_bit(lcd_rw,0);
   output_bit(lcd_en,0);
   delay_ms(50);
   output_bit(lcd_pwr,1);   // Turn on LCD     //
   delay_ms(100);
   lcd_on=1;
   send_nibble(0x30);
   delay_ms(50);
   send_nibble(0x30);
   delay_ms(10);
   send_nibble(0x30);
   delay_ms(10);
   send_nibble(0x20);
   sendLCDInstruction(0x28);         // 4 bit data-2 lines-5x7 dots
   delay_ms(5);
   sendLCDInstruction(0x0c);         // display on, no cursor, no blink
   delay_ms(5);
   //restart_wdt();
   LCDClear();
   }
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri May 19, 2006 11:52 am     Reply with quote

Don't write your own LCD driver, or at least don't do it initially.
Use an existing driver such as the CCS driver, LCD.C, which is in
this folder: c:\Program Files\PICC\Drivers

Or use one of the LCD drivers in the Code Library forum:
http://www.ccsinfo.com/forum/viewforum.php?f=2
cam_male2003



Joined: 21 Sep 2005
Posts: 12

View user's profile Send private message Yahoo Messenger

PostPosted: Mon May 22, 2006 10:49 am     Reply with quote

I will try that, thanks
Rolling Eyes
ckielstra



Joined: 18 Mar 2004
Posts: 3680
Location: The Netherlands

View user's profile Send private message

PostPosted: Mon May 22, 2006 11:48 am     Reply with quote

Just checking. What is the voltage you are running off?
According to the datasheet, figure 28-3, you'll need at least 3.3V at 25MHz for stable operation.
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