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

2X16 LCD on pic16f877a portb

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



Joined: 24 Jun 2004
Posts: 285

View user's profile Send private message

2X16 LCD on pic16f877a portb
PostPosted: Tue Jun 29, 2004 11:28 am     Reply with quote

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: 1912
Location: Norman, OK

View user's profile Send private message

LCD driver
PostPosted: Tue Jun 29, 2004 11:44 am     Reply with quote

Look in the code library and search this board for LCD driver.
young



Joined: 24 Jun 2004
Posts: 285

View user's profile Send private message

PostPosted: Tue Jun 29, 2004 2:28 pm     Reply with quote

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: 1912
Location: Norman, OK

View user's profile Send private message

LCD Display
PostPosted: Tue Jun 29, 2004 3:25 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Tue Jun 29, 2004 3:33 pm     Reply with quote

Thanks,
My God, I am waiting for any suggestions!!
My lCD is a whole line of Block.
young



Joined: 24 Jun 2004
Posts: 285

View user's profile Send private message

PostPosted: Tue Jun 29, 2004 3:42 pm     Reply with quote

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?
PostPosted: Wed Jun 30, 2004 8:39 am     Reply with quote

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

View user's profile Send private message

problem solved
PostPosted: Wed Jun 30, 2004 1:59 pm     Reply with quote

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.
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