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 CCS Technical Support

LCD gives only question marks...

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



Joined: 09 Apr 2012
Posts: 19
Location: Salem

View user's profile Send private message

LCD gives only question marks...
PostPosted: Mon Apr 09, 2012 10:56 pm     Reply with quote

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
Mike Walne



Joined: 19 Feb 2004
Posts: 1785
Location: Boston Spa UK

View user's profile Send private message

PostPosted: Tue Apr 10, 2012 3:23 am     Reply with quote

Smells like EMC issue (or loose/bad connection).

ASCII code for ? is 0x3f, i.e. odd 0 & string of 1s.

Mike
evan



Joined: 02 Apr 2012
Posts: 22

View user's profile Send private message

PostPosted: Tue Apr 10, 2012 3:48 am     Reply with quote

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



Joined: 16 Nov 2010
Posts: 588
Location: Kirkland, WA

View user's profile Send private message

PostPosted: Tue Apr 10, 2012 9:20 am     Reply with quote

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
gpsmikey



Joined: 16 Nov 2010
Posts: 588
Location: Kirkland, WA

View user's profile Send private message

PostPosted: Tue Apr 10, 2012 9:34 am     Reply with quote

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 ???? Twisted Evil

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
varadharaj



Joined: 09 Apr 2012
Posts: 19
Location: Salem

View user's profile Send private message

PostPosted: Tue Apr 10, 2012 10:36 am     Reply with quote

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
Ttelmah



Joined: 11 Mar 2010
Posts: 19498

View user's profile Send private message

PostPosted: Tue Apr 10, 2012 12:16 pm     Reply with quote

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
varadharaj



Joined: 09 Apr 2012
Posts: 19
Location: Salem

View user's profile Send private message

PostPosted: Tue Apr 10, 2012 7:14 pm     Reply with quote

@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
dyeatman



Joined: 06 Sep 2003
Posts: 1933
Location: Norman, OK

View user's profile Send private message

PostPosted: Tue Apr 10, 2012 8:55 pm     Reply with quote

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