auto_mitch
Full Member level 3

My project is to built an alarm clock. I want to display on lcd the current date and the time and with a keypad have access in a menu in which you can set the alarm time.
I try to use the ds1307 functions of codevision and i cannot get anything on lcd.I dont know what is going wrong. The only value that i can get by displaying the seconds is always 128. Can you help me?
I try to use the ds1307 functions of codevision and i cannot get anything on lcd.I dont know what is going wrong. The only value that i can get by displaying the seconds is always 128. Can you help me?
Code:
// I2C Bus functions
#asm
.equ __i2c_port=0x15 ;PORTC
.equ __sda_bit=1
.equ __scl_bit=0
#endasm
// Alphanumeric LCD Module functions
#asm
.equ __lcd_port=0x18 ;PORTA
#endasm
#include <mega16.h>
#include <i2c.h>
#include <lcd.h>
#include<stdio.h>
#include<stdlib.h>
#include<delay.h>
#include<ds1307.h>
char secbuffer[16];
void main(void)
{
unsigned char h,m,s;
// LCD Initialization.
lcd_init(16);
// I2C Initialization.
i2c_init();
delay_ms(100);
// Initialize the DS1307 RTC
rtc_init(0,0,0);
delay_ms(100);
rtc_set_time(04,05,22);
while (1)
{
rtc_get_time(&h,&m,&s);
sprintf(secbuffer,"%02d",s);
lcd_gotoxy(6,0);
lcd_puts(secbuffer);
};
}