View previous topic :: View next topic |
Author |
Message |
rfjhh
Joined: 31 Mar 2011 Posts: 51 Location: Mexico
|
Problems with lcd_init() |
Posted: Wed Feb 01, 2017 9:23 am |
|
|
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
|
|
Posted: Wed Feb 01, 2017 10:05 am |
|
|
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
|
|
Posted: Wed Feb 01, 2017 2:54 pm |
|
|
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
|
|
Posted: Wed Feb 01, 2017 3:10 pm |
|
|
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. |
|
|
|