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

Problems with lcd_init()

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



Joined: 31 Mar 2011
Posts: 51
Location: Mexico

View user's profile Send private message

Problems with lcd_init()
PostPosted: Wed Feb 01, 2017 9:23 am     Reply with quote

I'm working with an LCD 2x16 with the following program:
Code:

#include <16f887.h>                   
#use delay (clock=8MHz)            //Fosc=8Mhz
#include <lcd.c> 
#use fast_io(C)                   
#define use_portd_lcd TRUE

void e()
{
   output_bit(PIN_D0,1);
   delay_ms(1);
   output_bit(PIN_D0,0);
}
 
void main()
{
   setup_oscillator(OSC_8MHZ|OSC_INTRC);  //We program Pic internal oscillator to 8 MHz
   set_tris_c(0xfe);
//   lcd_init();   
//****** Init sequence made by me (it works well)           
   output_d(0x00);
   output_d(0x20);
   e();
   output_d(0x00);
   e();
   output_d(0xf0);
   e();
// ****** end of Init sequence

   printf(lcd_putc, "Hola Mundo");
// **** Printing "H" for test
 /*  output_d(0x40|0x02);             
   e();
   output_d(0x80|0x02);             
   e();*/
   while(1)
   {
      delay_ms(10);                       // Wait for 10 ms
      output_toggle(PIN_B5);              // We blink Led, output_toggle changes the logical state of the last parameter pin
      delay_ms(250);                     // Wait for 250 ms
   }
}

If I enable lcd_init() (disabling my Init sequence), the program doesn't work. But, if I disable lcd_init() and I use my sequence, the string "Hola Mundo" is well displayed.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Feb 01, 2017 10:05 am     Reply with quote

Post the manufacturer and part number of your LCD.

Post a link to the website for the lcd.
rfjhh



Joined: 31 Mar 2011
Posts: 51
Location: Mexico

View user's profile Send private message

PostPosted: Wed Feb 01, 2017 2:54 pm     Reply with quote

I'm simulating in Proteus. The LCD model works well if I perform Initialization and writing with debugging tools, step by step by assigning logic states manually.

The LCD is an standard one, nothing special. I don't know who the manufacturer is.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Feb 01, 2017 3:10 pm     Reply with quote

The lcd doesn't have a brand. It's the Proteus model. Someone made
that model. Where is the spec for that model ? I don't know.

Here, someone is writing code for a Proteus lcd model. He doesn't use
your init code. He uses the standard old Hitachi HD44780 init code.
http://www.theengineeringprojects.com/2015/12/interfacing-lcd-8051-microcontroller-proteus-isis.html

I guess your post is asking why do you have to use your init code instead
of the HD44780 code in lcd.c ? It must be something in your version of
Proteus that is different. We can't fix that on this forum. You should go
to the labcenter (proteus) forum and ask them.
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