|
|
View previous topic :: View next topic |
Author |
Message |
leeyung
Joined: 23 Feb 2009 Posts: 4
|
Problem in Using LCD 16X2 (Model: Topway LMB162ABC) |
Posted: Mon Mar 02, 2009 5:10 am |
|
|
Hi all, I am very new to electronics. I would like to seek help regarding the initialization of LCD with PIC16F877A. I had configured my hardware PIC16F877A to connect with this 16X2 LCD (Topway LMB162ABC). I am using Port B to interface with the LCD.
RB0 = E
RB1 = RS
RB2 = R/W
and I'm using 4-Bit Mode
so
RB7 = Data Line 7
RB6 = Data Line 6
RB5 = Data Line 5
RB4 = Data Line 4
Contrast of LCD had been set too
I am using PCW C Compiler to compile my Hex file. Below is my simple program that used to test the LCD but unfortunately, it doesn't show up anything... any idea?
Code: | #include <16f877a.h>
#use delay(clock = 20000000)
#fuses hs, noprotect, nowdt, nolvp
#define use_portb_lcd TRUE
#include <lcd.c>
#byte PORTB=6
void main()
{ set_tris_b(0);
lcd_init();
do{
lcd_putc("\fTESTING\n");
}while(1);
}
|
The output of the LCD as shown like this....
|
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Mon Mar 02, 2009 11:55 am |
|
|
Use the Flex driver. It's easier:
http://www.ccsinfo.com/forum/viewtopic.php?t=24661
Carefully check all your connections. Make sure you are using
the correct pin numbers on the LCD and the PIC.
If you have never done anything with a PIC before, don't start with
an lcd. Start with an LED blinking program:
Code: | #include <16F877A.H>
#fuses HS, NOWDT, NOPROTECT, BROWNOUT, PUT, NOLVP
#use delay(clock=20000000)
//===============================
void main()
{
while(1)
{
output_high(PIN_B0); // Blink LED on Pin B0
delay_ms(500);
output_low(PIN_B0);
delay_ms(500);
}
} |
|
|
|
|
|
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
|