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

probelems with ds1307 and lcd

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



Joined: 19 Oct 2006
Posts: 2

View user's profile Send private message

probelems with ds1307 and lcd
PostPosted: Thu Nov 09, 2006 4:59 am     Reply with quote

hi..
i made a program for ds1307 whit 18f452 and it is functional,for display i use port serial (rs232),the program is ok Razz
BUT when i use the lcd display ???, i don't know what is the problem but the program is freezen Sad
program no 1,this is ok:
void main()
{

BYTE sec;
BYTE min;
BYTE hrs;
BYTE day;
BYTE month;
BYTE yr;
BYTE dow;

setup_adc_ports(NO_ANALOGS);
setup_adc(ADC_OFF);
setup_psp(PSP_DISABLED);
setup_spi(FALSE);
setup_wdt(WDT_OFF);
setup_timer_0(RTCC_INTERNAL);
setup_timer_1(T1_DISABLED);
setup_timer_2(T2_DISABLED,0,1);
setup_timer_3(T3_DISABLED|T3_DIV_BY_1);
setup_oscillator(False);
ext_int_edge(H_TO_L);
enable_interrupts(INT_EXT);
enable_interrupts(GLOBAL);

ds1307_init();
//lcd_init();
// Set date for -> 15 June 2005 Tuesday
// Set time for -> 15:20:55
//ds1307_set_date_time(8,11,6,3,15,8,55);


while(1)
{
delay_ms(1000);

ds1307_get_date(day,month,yr,dow);
ds1307_get_time(hrs,min,sec);

printf("\f\%02d/\%02d/\%02d\r\n",day,month,yr);
printf("\%02d:\%02d:\%02d", hrs,min,sec);

/*lcd_gotoxy(1,1);
printf(lcd_putc,"Time : %02d:%02d:%02d",hrs,min,sec);
lcd_gotoxy(1,2);
printf(lcd_putc,"Data : %02d:%02d:%02d",day,month,yr);*/

}

}


program no 2 i init the lcd and it isn't functional:
void main()
{

BYTE sec;
BYTE min;
BYTE hrs;
BYTE day;
BYTE month;
BYTE yr;
BYTE dow;

setup_adc_ports(NO_ANALOGS);
setup_adc(ADC_OFF);
setup_psp(PSP_DISABLED);
setup_spi(FALSE);
setup_wdt(WDT_OFF);
setup_timer_0(RTCC_INTERNAL);
setup_timer_1(T1_DISABLED);
setup_timer_2(T2_DISABLED,0,1);
setup_timer_3(T3_DISABLED|T3_DIV_BY_1);
setup_oscillator(False);
ext_int_edge(H_TO_L);
enable_interrupts(INT_EXT);
enable_interrupts(GLOBAL);

ds1307_init();
lcd_init();
// Set date for -> 15 June 2005 Tuesday
// Set time for -> 15:20:55
//ds1307_set_date_time(8,11,6,3,15,8,55);


while(1)
{
delay_ms(1000);

ds1307_get_date(day,month,yr,dow);
ds1307_get_time(hrs,min,sec);

/*printf("\f\%02d/\%02d/\%02d\r\n",day,month,yr);
printf("\%02d:\%02d:\%02d", hrs,min,sec);*/

lcd_gotoxy(1,1);
printf(lcd_putc,"Time : %02d:%02d:%02d",hrs,min,sec);
lcd_gotoxy(1,2);
printf(lcd_putc,"Data : %02d:%02d:%02d",day,month,yr);

}

}
Ttelmah
Guest







PostPosted: Thu Nov 09, 2006 5:29 am     Reply with quote

Start simpler.
Throw away all the clock stuff. Do a simple prgram, that just tries to write a message to the LCD. Does this work?. The most likely reason for the LCD functions 'freezing', is a connection error. It will wait till it sees the display go 'not busy', when trying to send data. A 'classic' that causes this, is using the wrong four data lines from the LCD (it is the upper four lines that have to connect, not the low four lines).

Best Wishes
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