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

cannot show LCD on line 2

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







cannot show LCD on line 2
PostPosted: Sat Oct 24, 2009 1:07 am     Reply with quote

Hi
I just transfer from MikroC to CCS.
I am wonder it may simple for you but I can not do.
I have 2 problem need help.

1) I can not write string on LCD second line.(2X16) it show only first line.
2) Need to reset many times to start program (Observe from something appear or disappear on LCD).
And after turn on power to PIC sometime work sometime not work (need to reset many time).

Please some help me. Simple code below.
Code:

#include <18F4550.h>
#fuses HSPLL,NOWDT,NOPROTECT,NOLVP,NODEBUG,USBDIV,PLL5,CPUDIV1,VREGEN
#use delay(clock=48000000)
#use rs232(baud=38400, xmit=PIN_C6, rcv=PIN_C7)
 
#include <lcd.c>
#include <string.h>
#include <input.c>

void main(){
int32 str1 =  11115;
int32 str2 =  21115;
int32 str3 =  31115 ;
int32 str4 =  41115 ;

Lcd_Init();                   // Initialize LCD I use PortD

lcd_putc('\f');   
printf(lcd_putc,"%lu",str1);    //Display result
lcd_gotoxy(10,1);
printf(lcd_putc,"%lu",str2);    //Display result
lcd_gotoxy(1,2);
printf(lcd_putc,"%lu",str3);    //Display result
lcd_gotoxy(10,2);
printf(lcd_putc,"%lu",str4);    //Display result
     
while(TRUE){
 }
}
Rohit de Sa



Joined: 09 Nov 2007
Posts: 282
Location: India

View user's profile Send private message Visit poster's website

PostPosted: Sat Oct 24, 2009 7:31 am     Reply with quote

Try displaying something simple first. Use this code:

Code:
printf(lcd_putc, "\f");           \\clears the screen
printf(lcd_putc,"Hey!");                 \\first line
printf(lcd_putc,"\n");                     \\new line
printf(lcd_putc,"Test line 2");


Regarding your need to reset, put a small delay after lcd_init(). Maybe
Code:
delay_ms(50);


Quote:
And after turn on power to PIC sometime work sometime not work
Try to isolate the cause of this problem. Is it due to the LCD itself? Or is it caused by the PIC. Write a simple program to blink an LED. If it works fine, then your LCD (or the interface to the LCD) is what is causing the problem. If the LED blinking does not work, then you need to concentrate your troubleshooting to the PIC.

The reset problem could also be due to a noisy power supply, missing resistor on MCLR, watchdog timer (though from the code you posted, it doesn't seem so), maybe even the LCD backlight sucking a whole lot of power (try adding a series resistor to the LCD backlight LED if this is the case).

Your reset problem is very vaguely posted. I won't be able to help you without further details. Try the solutions above and post your results.

Rohit
trirath
Guest







PostPosted: Sun Oct 25, 2009 10:34 pm     Reply with quote

I put some little delay that you advised. Anything cleared
but need to be delay_ms(100) for my LCD.

Thank
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