PIC18F4550 and ds1307 code for displaying sec on LCD

Status
Not open for further replies.

ahmet2004

Member level 3
Joined
Jan 1, 2004
Messages
63
Helped
3
Reputation
6
Reaction score
2
Trophy points
1,288
Activity points
383
hi!!!

The only changes i made are as below

#define RTC_SDA PIN_B0
#define RTC_SCL PIN_B1

and this is codes

#include <18F4550.h>
#fuses HSPLL,USBDIV,PLL5,CPUDIV1,VREGEN,NOWDT,NOPROTECT,NOLVP
#use delay(clock=48000000) //,RESTART_WDT

#include <ds1307.c>

#include <lcd.c>

#define LCD_RS PIN_D0
#define LCD_RW PIN_D1
#define LCD_E PIN_D2
#define LCD_DB4 PIN_D4
#define LCD_DB5 PIN_D5
#define LCD_DB6 PIN_D6
#define LCD_DB7 PIN_D7

void main()
{
BYTE sec;
BYTE min;
BYTE hrs;
BYTE day;
BYTE month;
BYTE yr;
BYTE dow;

lcd_init();
ds1307_init();


// Set date for -> 29 June 2008 Sunday
// Set time for -> 17:36:09
ds1307_set_date_time(29,6,8,7,17,36,9);

while(1)
{
delay_ms(1000);

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

lcd_putc(sec);

}
}

i want to display sec on LCD. but i couldnt get number. instead i have a black block blinking on my LCD screen. i saw the original codes. it uses #device adc=8 but i didnt use it because when i compile the code, that line caused error.

anybody has any idea why it's not working?

thanks ?
 

pic18f4550 c18 blinking

Do you have declaration and/or source code of ds1307_get_time() and lcd_putc() functions?

IMO, you are possibly doing a programming error, or there isn't consistancy between your code and your hardware.


BTW, which IDE are you using for writing that C code? MPLAB or something else?
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…