Pumpkin, Inc.

Pumpkin User Forums

need help in correcting errors urgently

For issues specific to Microchip's PICmicro® MCUs, including compilers (e.g. HI-TECH PICC & PICC-18, Microchip MPLAB®-C18) and IDEs (e.g. Microchip MPLAB®).

need help in correcting errors urgently

Postby weifeng » Thu Feb 09, 2006 7:39 am

hi,

i m working on a DS1307 RTC program. i am using MPLAB IDE/C18 compiler. while trying to build the program, there are errors in it. can anyone help mi with the errors? i nid to get it done soon... the line in caps is a syntax error...thanx

#define DS1307_SDA PIN_B1
#define DS1307_SCL PIN_B0
void boot_up(void);
void rtc_programming(void);
void read_rtc(void);

//==========================
// initial DS1307
//==========================
void init_DS1307()
{
output_float(DS1307_SCL);
output_float(DS1307_SDA);
}
//==========================
// write data one byte to
// DS1307
//==========================
void rtc_set(unsigned char rtcreg)
{
short int status;
i2c_start();
i2c_write(0xd0);
i2c_write(address);
i2c_write(data);
i2c_stop();
i2c_start();
status=i2c_write(0xd0);
while(status==1)
{
i2c_start();
status=i2c_write(0xd0);
}
}
//==========================
// read data one byte from DS1307
//==========================
BYTE READ_DS1307(BYTE ADDRESS)
{
byte data;
i2c_start();
i2c_write(0xd0);
i2c_write(address);
i2c_start();
i2c_write(0xd1);
data=i2c_read(0);
i2c_stop();
return(data);
}


i knew that byte was not an integer type for C18 compiler.
i tried using unsigned char, but still the same syntax error....


weifeng
 
Posts: 1
Joined: Thu Feb 09, 2006 12:00 am
Location: Singapore

Re: need help in correcting errors urgently

Postby zoomcityzoom » Wed Feb 15, 2006 11:56 am

Hopefully you have this fixed by now, but if not, what does your function prototype for
READ_DS1307() look like?
What is the specific compiler error you are receiveing?

[This message has been edited by zoomcityzoom (edited February 15, 2006).]

Tom Deutschman
Wizbang Designs, Inc.
zoomcityzoom
 
Posts: 13
Joined: Sat Dec 24, 2005 12:00 am
Location: Spokane, WA, USA


Return to PICmicro MCUs

Who is online

Users browsing this forum: No registered users and 3 guests

cron