LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 02-08-2006, 08:07 PM   #1
weifeng
LQ Newbie
 
Registered: Feb 2006
Posts: 4

Rep: Reputation: 0
need help in correcting errors urgently


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

#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);
}
 
Old 02-08-2006, 09:25 PM   #2
freegianghu
Member
 
Registered: Oct 2004
Location: somewhere in the street
Distribution: Window$
Posts: 192

Rep: Reputation: 30
Define byte type before using it
Code:
#define byte char
 
Old 02-08-2006, 11:56 PM   #3
weifeng
LQ Newbie
 
Registered: Feb 2006
Posts: 4

Original Poster
Rep: Reputation: 0
hi,

but after putting that define line in, stil not successful. and this cums out:

MPLAB C18 v3.00 (demo)
Copyright 1999-2005 Microchip Technology Inc.
Days remaining until demo becomes feature limited: 12
C:\Documents and Settings\user\My Documents\feng.c:13:Error [1105] symbol 'PIN_B0' has not been defined
C:\Documents and Settings\user\My Documents\feng.c:13:Warning [2058] call of function without prototype
C:\Documents and Settings\user\My Documents\feng.c:14:Error [1105] symbol 'PIN_B1' has not been defined
C:\Documents and Settings\user\My Documents\feng.c:14:Warning [2058] call of function without prototype
C:\Documents and Settings\user\My Documents\feng.c:23:Warning [2058] call of function without prototype
C:\Documents and Settings\user\My Documents\feng.c:24:Warning [2058] call of function without prototype
C:\Documents and Settings\user\My Documents\feng.c:25:Error [1105] symbol 'address' has not been defined
C:\Documents and Settings\user\My Documents\feng.c:25:Warning [2058] call of function without prototype
C:\Documents and Settings\user\My Documents\feng.c:26:Error [1105] symbol 'data' has not been defined
C:\Documents and Settings\user\My Documents\feng.c:26:Warning [2058] call of function without prototype
C:\Documents and Settings\user\My Documents\feng.c:27:Warning [2058] call of function without prototype
C:\Documents and Settings\user\My Documents\feng.c:28:Warning [2058] call of function without prototype
C:\Documents and Settings\user\My Documents\feng.c:29:Warning [2058] call of function without prototype
C:\Documents and Settings\user\My Documents\feng.c:32:Warning [2058] call of function without prototype
C:\Documents and Settings\user\My Documents\feng.c:33:Warning [2058] call of function without prototype
C:\Documents and Settings\user\My Documents\feng.c:42:Warning [2058] call of function without prototype
C:\Documents and Settings\user\My Documents\feng.c:43:Warning [2058] call of function without prototype
C:\Documents and Settings\user\My Documents\feng.c:44:Warning [2058] call of function without prototype
C:\Documents and Settings\user\My Documents\feng.c:45:Warning [2058] call of function without prototype
C:\Documents and Settings\user\My Documents\feng.c:46:Warning [2058] call of function without prototype
C:\Documents and Settings\user\My Documents\feng.c:47:Warning [2058] call of function without prototype
C:\Documents and Settings\user\My Documents\feng.c:48:Warning [2058] call of function without prototype
Halting build on first failure as requested.
BUILD FAILED: Thu Feb 09 13:52:55 2006

 
Old 02-09-2006, 12:54 AM   #4
Wim Sturkenboom
Senior Member
 
Registered: Jan 2005
Location: Roodepoort, South Africa
Distribution: Ubuntu 12.04, Antix19.3
Posts: 3,794

Rep: Reputation: 282Reputation: 282Reputation: 282
Quote:
C:\Documents and Settings\user\My Documents\feng.c:13:Error [1105] symbol 'PIN_B0' has not been defined
You still need to add an include that defines PIN_B0. Search in the provided include files for PIN_B0. Use a line in your code before you use PIN_B0 as shown below.
Code:
#include <file_that_i_found>
#define DS1307_SCL PIN_B0
Quote:
C:\Documents and Settings\user\My Documents\feng.c:25:Warning [2058] call of function without prototype
You use functions like output_float, i2c_start etc. I'm not sure if those are standard functions that come with the C-compiler or that you still have to write them. In the first case, do the same as above, in the second case do what you already did in your code
Code:
void boot_up(void);
void rtc_programming(void);
void read_rtc(void);
// add your prototypes here
Quote:
C:\Documents and Settings\user\My Documents\feng.c:25:Error [1105] symbol 'address' has not been defined
address and data are not defined in the following piece of code
Code:
void rtc_set(unsigned char rtcreg)
{
short int status;
i2c_start();
i2c_write(0xd0);
i2c_write(address);
i2c_write(data);
With the above hints, you should be able to compile it.
 
Old 02-10-2006, 12:26 AM   #5
weifeng
LQ Newbie
 
Registered: Feb 2006
Posts: 4

Original Poster
Rep: Reputation: 0
hi,

thanx veri much for your help, i am actually very poor and slow in understanding programming.... i know your hints are useful, and shd b able to make it if i hav veri gd knowledge in programming... i juz duno hw to go abt correcting it... anyway, reali thx for helping.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Correcting a yum dependency issue muppetmaster Fedora 3 11-02-2005 03:28 AM
auto correcting spelling stuff Niflheim Linux - General 1 04-01-2005 01:22 AM
ntpd not correcting local time plythgam Linux - Software 1 08-16-2004 04:12 PM
Problem Correcting Dependencies Dip Linux - Software 4 12-25-2003 08:16 AM
Correcting e-mails in Evolution 1.4.5 finrold Linux - Software 0 10-29-2003 04:48 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:27 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration