linear1 forums
[part of the linear1 network]
+ [linear1 case mods]
+ [LED Center]
+ [privacy policy]
Welcome, Guest. Please login or register.
March 20, 2010, 02:16:22 PM

Login with username, password and session length
Search:     Advanced search
* Home Help Search Login Register

linear1 forums  |  LED discussion  |  Microcontroller madness  |  Topic: need help in correcting errors urgently « previous next »
Pages: [1] Print
Author Topic: need help in correcting errors urgently  (Read 866 times)
weifeng
Strong like bull
*
Offline Offline

Posts: 1


« on: February 09, 2006, 01:52:57 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 red is a syntax error...thanx   Sad

#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);
}
Logged
SurJector
Smart like tractor
***
Offline Offline

Posts: 107


« Reply #1 on: February 09, 2006, 03:48:23 AM »

I've not ever programmed with this kind of compiler. Is "byte" correct ? It could be "char" or "unsigned char"...
Logged
Pages: [1] Print 
linear1 forums  |  LED discussion  |  Microcontroller madness  |  Topic: need help in correcting errors urgently « previous next »
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.7 | SMF © 2006-2008, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Page created in 0.111 seconds with 18 queries.