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

glcd problem using 18f452 and ds1307

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



Joined: 13 Feb 2008
Posts: 2

View user's profile Send private message

glcd problem using 18f452 and ds1307
PostPosted: Thu Mar 13, 2008 12:03 am     Reply with quote

write program I used glcd and ds1307 and I convert from numbers to string and if number increase 10 and string numbers mixed and simulate proteus below write a code;

Code:

ds1307_get_time(hr,min,sec);
sprintf(hour_s,"%d",hr);
sprintf(min_s,"%d",min);
sprintf(sec_s,"%d",sec);
delay_ms(5);
//*********************** display glcd ******************************************
glcd_text57(10,3,text1,1,ON);
glcd_text57(1,15,text2,1,ON);
glcd_text57(32,15,text8,1,ON);
glcd_text57(65,15,text3,1,ON);
glcd_text57(90,15,text9,1,ON);
glcd_text57(10,25,text4,1,ON);
glcd_text57(45,25,hour_s,1,ON);
glcd_text57(58,25,text10,1,ON);
glcd_text57(65,25,min_s,1,ON);
glcd_text57(78,25,text10,1,ON);
glcd_text57(85,25,sec_s,1,ON);
glcd_text57(10,35,text11,1,ON);
glcd_text57(1,45,text6,1,ON);
glcd_text57(52,45,text7,1,ON);
glcd_text57(45,55,text12,1,ON);

and show a photos first photo is error photo

second photo minutes value is lower than ten number(correct working)
Douglas Kennedy



Joined: 07 Sep 2003
Posts: 755
Location: Florida

View user's profile Send private message AIM Address

PostPosted: Thu Mar 13, 2008 12:15 am     Reply with quote

If you aren't aware the the DS1307 time date registers are in BCD or if you are aware and you haven't made that adjustment in the DS1307_get_time then the time and date are in bcd but you are using them as if they were decimal. Now that means bcd values that don't flow into the higher nibble( i.e values less than ten) will work others will not.
Your output looks even worse than I would expect if you left out BCD to decimal conversion so this may not be the answer.
isidur



Joined: 13 Feb 2008
Posts: 2

View user's profile Send private message

PostPosted: Thu Mar 13, 2008 11:52 am     Reply with quote

DS1307_get_time converted BCD to integer and but I expect sprintf function(integer convert to string) is not correct working because others number(adjust time and date function) same mistake
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