View previous topic :: View next topic |
Author |
Message |
varadharaj
Joined: 09 Apr 2012 Posts: 19 Location: Salem
|
LCD gives only question marks... |
Posted: Mon Apr 09, 2012 10:56 pm |
|
|
Hi,
I am using pic16f877a with rtc for my project for switching the ac load by triggering Triac. The display is updating time and ac load working perfectly. It is working fine.
But sometimes the lcd is giving ???????????? marks in one row. It is not happening in switching the ac load...
Why it is happening? I am using DS1307 as a RTC with battery backup.
Thanks _________________ Embedding Innovation |
|
![](templates/subSilver/images/spacer.gif) |
Mike Walne
Joined: 19 Feb 2004 Posts: 1785 Location: Boston Spa UK
|
|
Posted: Tue Apr 10, 2012 3:23 am |
|
|
Smells like EMC issue (or loose/bad connection).
ASCII code for ? is 0x3f, i.e. odd 0 & string of 1s.
Mike |
|
![](templates/subSilver/images/spacer.gif) |
evan
Joined: 02 Apr 2012 Posts: 22
|
|
Posted: Tue Apr 10, 2012 3:48 am |
|
|
Check the signal timings, these displays often need delays to be added - it could be that you are "on the edge" and sometimes it fails. |
|
![](templates/subSilver/images/spacer.gif) |
gpsmikey
Joined: 16 Nov 2010 Posts: 588 Location: Kirkland, WA
|
|
Posted: Tue Apr 10, 2012 9:20 am |
|
|
You might also look carefully at the spec sheet for the LCD you are using and see if there is a range of characters etc that will print as "?" - see if that would explain what you are seeing. Some displays show what they consider non-printable characters as question marks - if you are using a serial interface to the LCD and it loses track of where the start bit is, you can get a strange range of characters (and the pause between lines would get it back in sync again).
mikey _________________ mikey
-- you can't have too many gadgets or too much disk space !
old engineering saying: 1+1 = 3 for sufficiently large values of 1 or small values of 3 |
|
![](templates/subSilver/images/spacer.gif) |
gpsmikey
Joined: 16 Nov 2010 Posts: 588 Location: Kirkland, WA
|
|
Posted: Tue Apr 10, 2012 9:34 am |
|
|
Well, that was entertaining - when I tried to post, all I got was some sort of php DEBUG error showing, but when I came back later, it shows it posted it a number of times (all I ever got was the debug error from the board). I did manage to delete the duplicates (I think)
[edit] still seeing that - what shows when I hit post is
Code: | General Error
Failed sending email :: PHP ::
DEBUG MODE
Line : 234
File : emailer.php
|
Is the Tuesday bit set ????
mikey _________________ mikey
-- you can't have too many gadgets or too much disk space !
old engineering saying: 1+1 = 3 for sufficiently large values of 1 or small values of 3 |
|
![](templates/subSilver/images/spacer.gif) |
varadharaj
Joined: 09 Apr 2012 Posts: 19 Location: Salem
|
|
Posted: Tue Apr 10, 2012 10:36 am |
|
|
Thanks for your quick replies. I am trying like this way.... I am using LCD.c from pcm compiler only. I am using rtc.c from ccsforum.
Code: |
void main()
{
ds1307_init();
lcd_init();
set_time(parameters);
while(1)
{
get_time(parameters);
printf(lcd_putc,parameters);
delay_ms(900);
}
}
|
I have coded like above... How to change the delay to rectify that question mark problem in LCD. I am using 16x2 display??? _________________ Embedding Innovation |
|
![](templates/subSilver/images/spacer.gif) |
Ttelmah
Joined: 11 Mar 2010 Posts: 19366
|
|
Posted: Tue Apr 10, 2012 12:16 pm |
|
|
Well start by getting the syntax for your printf correct.
Syntax _required_ is:
printf(lcd_putc,"format string to print with",what you want to print);
You are lacking the format string to print 'parameters'. No wonder the code prints garbage....
Best Wishes |
|
![](templates/subSilver/images/spacer.gif) |
varadharaj
Joined: 09 Apr 2012 Posts: 19 Location: Salem
|
|
Posted: Tue Apr 10, 2012 7:14 pm |
|
|
@Ttelmah,
Sorry , I have confused you. I have given in your format only. For short i have written like that. The actual code is,
Code: | void main()
{
char on_time = 10, off_time = 11;
set_tris_d(0x00);
output_d(0xff);
ds1307_init();
lcd_init();
set_time(parameters);
while(1)
{
lcd_gotoxy(1,1);
get_time(parameters);
printf(lcd_putc,"format",parameters);
if(time == on_time) // checking only hours
output_low(pin_d0); // low activated for opto coupler
if(time == off_time) // checking only hours
output_high(pin_d0);
delay_ms(900);
}
} |
_________________ Embedding Innovation |
|
![](templates/subSilver/images/spacer.gif) |
dyeatman
Joined: 06 Sep 2003 Posts: 1924 Location: Norman, OK
|
|
Posted: Tue Apr 10, 2012 8:55 pm |
|
|
Please read up on how to use a printf statement. This line from your code is not correct:
Code: | printf(lcd_putc,"format",parameters); |
_________________ Google and Forum Search are some of your best tools!!!! |
|
![](templates/subSilver/images/spacer.gif) |
|