View previous topic :: View next topic |
Author |
Message |
young
Joined: 24 Jun 2004 Posts: 285
|
2X16 LCD on pic16f877a portb |
Posted: Tue Jun 29, 2004 11:28 am |
|
|
I want to display characters on my 2X16 LCD display using portB, my pic is 16f877a , anyone have the code that I could use?
Thanks |
|
|
dyeatman
Joined: 06 Sep 2003 Posts: 1934 Location: Norman, OK
|
LCD driver |
Posted: Tue Jun 29, 2004 11:44 am |
|
|
Look in the code library and search this board for LCD driver. |
|
|
young
Joined: 24 Jun 2004 Posts: 285
|
|
Posted: Tue Jun 29, 2004 2:28 pm |
|
|
I check all the possible program and used one that blink the c2 & c3 and show the status on the LCD program.
what I changed is the LCD file
Un-comment the following define to use port B
1. #define use_portb_lcd TRUE
2. and changed while ( bit_test(lcd_read_byte(),7) ) (two locations in LCD.C)
to
while ( bit_test(lcd_read_byte(),7) ){
{
delay_us (25 );
break;
}
then after I compile the file and let it run, the c2 & c3 are blinking, the RB7 was turned on, but no data showed on the LCD, what should I do to display characters on LCD
the following is the test program
please help me out
#include <16F877A.h>
#use delay(clock=2000000)
#fuses HS, NOWDT, NOPROTECT, NOPUT, NOBROWNOUT, NOLVP
#byte port_c=7
#define led1 PIN_C2
#define led2 PIN_C3
#include <lcd.c>
void main()
{
lcd_init();
set_tris_c(0x00);
port_c=0;
printf(lcd_putc,"Look this leds");
do
{
output_high(led1);
output_low(led2);
delay_ms(100);
output_low(led1);
output_high(led2);
delay_ms(100);
}while(true);
} |
|
|
dyeatman
Joined: 06 Sep 2003 Posts: 1934 Location: Norman, OK
|
LCD Display |
Posted: Tue Jun 29, 2004 3:25 pm |
|
|
What are you seeing on the LCD?
A blinking underline cursor?
A solid block? A whole line of blocks? Nothing at all? |
|
|
young
Joined: 24 Jun 2004 Posts: 285
|
|
Posted: Tue Jun 29, 2004 3:33 pm |
|
|
Thanks,
My God, I am waiting for any suggestions!!
My lCD is a whole line of Block. |
|
|
young
Joined: 24 Jun 2004 Posts: 285
|
|
Posted: Tue Jun 29, 2004 3:42 pm |
|
|
when I plug the power off for a while and plug the power on again, the RC7 turn off, only RC2 and RC3 is blinking? |
|
|
Guest
|
what the lcd connection could be? |
Posted: Wed Jun 30, 2004 8:39 am |
|
|
I checked my LCD connection with portB
it is like this
PortB LCD
B7 D7
B6 D6
B5 D5
B4 D4
B3 Enable
B2 Rs
Rw connected to Vss
Vdd +5V
However
PortD LCD
D7 D7
D6 D6
D5 D5
D4 D4
D0 Enable
D1 Rs
D2 Rw connected
when I use #define use_portb_lcd
how does lcd.c configure the connection? is this the place why my program dot working, in my case how to modify lcd program? |
|
|
young
Joined: 24 Jun 2004 Posts: 285
|
problem solved |
Posted: Wed Jun 30, 2004 1:59 pm |
|
|
Like the sequence of my posting, I get the following experience to run the LCD
1. Make sure the connection is connection, neither for port B or port D, the connection for using the lcd.c is
PortD LCD
D7 D7
D6 D6
D5 D5
D4 D4
D0 Enable
D1 Rs
D2 Rw connected
PortB LCD
B7 D7
B6 D6
B5 D5
B4 D4
B0 Enable
B1 Rs
B2 Rw connected
2. Change while ( bit_test(lcd_read_byte(),7) ) to
while ( bit_test(lcd_read_byte(),7) )
{
delay_us (25 );
break;
}
then it will work. |
|
|
|