| Details |
Message |
|
Read-Only
Author Anshik Kulshreshtha
Posted 7-May-2012 11:26 GMT
Toolset C51
|
 programming is howing error
Anshik Kulshreshtha
i am working on a project for the automatic power reading using
gsm
but getting some errors:
please check the program and guide me
Build target 'Target 1'
compiling codec.c...
codec.c(2): warning C318: can't open file 'lcd.h'
codec.c(3): warning C318: can't open file 'rtc.h'
codec.c(5): warning C318: can't open file 'bcd2ascii.h'
codec.c(6): warning C318: can't open file 'serial.h'
CODEC.C(35): warning C206: 'lcdInit': missing function-prototype
CODEC.C(36): warning C206: 'LCDstr': missing function-prototype
CODEC.C(36): error C267: 'LCDstr': requires ANSI-style prototype
Target not created
#include<reg52.h>
#include <lcd.h>
#include <rtc.h>
#include<string.h>
#include<bcd2ascii.h>
#include<serial.h>
sbit sw1=P3^7;
sbit sw2=P3^6;
sbit sw3=P3^5;
sbit buzzer=P2^3;
sbit relay=P2^2;
sbit rled =P3^4;
sbit gled =P3^3;
bit flag_sw,flagr=0;
static unsigned char k=0,s=0x84,*result,h,unit=0;
unsigned char inc=23,check_flag=0,month_flag=0,month;
unsigned char *time,*res;
unsigned char idata byte1[100];
unsigned char *date,*u,i,j,a=0,b,c,d;
void main()
{ TMOD=0x20; // serial communication intialization
TH1=0XFD;SCON=0X50;TR1=1;i=0;
IE=0X91;IT0=0;
lcdInit(); // LCD intialization
LCDstr("AUTOMATIC POWER",0x80);
LCDstr("METER READING",0xc0);
delay(2000);
gsm_check();gsm_rec(); //gsm modem intialization
gled=0;rled=1;buzzer=1;relay=1;
while(1) //super loop
{
//time display
LCDstr("DATE ",0x80);
LCDstr("TIME",0xc0);
date=getDate();
LCDstr(date,0x86);
time=getTime();
LCDstr(time,0xc6);
flag_sw=0;delay(1000);
//units display
putComL(0x01);
LCDstr("UNITS=",0x80);
putComL(0x86);
unit=getCharE(0x15);
u=bcdtoascii(unit);
LCDstr(u,0x87);
delay(2000);
/**************checking********************/
a=getCharE(0x04); // gsm modem sending sms
if(a>=28 )
{ gsm_check();
delay(200);
ES=0;
unit=0;
putCharE(unit,0x15);
rled=0;gled=1;
gsm_send(byte,"number"); }
//else case
if(a>=16 & d==c){month_flag=1;}
else month_flag=0;month_flag=getCharE(0x20);
if(check_flag==0 & month_flag==1
&flagr==0){flagr=1;relay=0;rled=0;gled=1;buzzer=0;delay(100);buzzer=1;}
else if(check_flag==1 ){ gled=0;rled=1;buzzer=1;relay=1;}
delay(1000);
//receving sms
for(j=0;j<100;j++) {if(byte1[j]=='*' &byte1[j+1]=='P' &
byte1[j+2]=='A'& byte1[j+3]=='I'& byte1[j+4]=='D')
{ES=0;LCDstr("received",0xc0);
a=1;check_flag=1;putCharE(check_flag,0x10); gsm_rec(); }} //time
setting
if(sw3==0){enter_time();}
delay(1000);k=0;
}}
Please Guide Me...
|
|
|
Read-Only
Author Per Westermark
Posted 7-May-2012 11:41 GMT
Toolset C51
|
 RE: programming is howing error
Per Westermark
Exactly what guiding do you feel you need?
codec.c(2): warning C318: can't open file 'lcd.h'
codec.c(3): warning C318: can't open file 'rtc.h'
codec.c(5): warning C318: can't open file 'bcd2ascii.h'
codec.c(6): warning C318: can't open file 'serial.h'
Do you have such files?
You are including them with <> like:
#include <lcd.h>
#include<string.h>
#include<bcd2ascii.h>
#include<serial.h>
Which would imply that they are files available in the standard
include paths - but they are not part of the C standard so why do you
expect the compiler to find them?
If you did copy code from an existing project that did use these
files - why haven't you then also copied these files?
And remember that it isn't enough to have header files. You also
need a library, object files or C/C++ files that contains the actual
implementations of the functions.
In the end, this is standard C questions - how to make use of
additional code modules written by someone else and get the compiler
to find the header files, build all relevant source files and then
link the program together with the extra modules.
|
|
|
Read-Only
Author Per Westermark
Posted 7-May-2012 11:42 GMT
Toolset C51
|
 RE: programming is howing error
Per Westermark
Question also duplicated in thread: http://www.keil.com/forum/20821/
|
|
|
Read-Only
Author Andrew Neil
Posted 7-May-2012 11:59 GMT
Toolset None
|
 difference between the two #include forms
Andrew Neil
difference between #include <file> and
#include "file"
Basic 'C' textbook stuff:
http://publications.gbdirect.co.uk/c_book/chapter7/directives.html
(scroll down to section 7.3.4)
http://c-faq.com/cpp/inclkinds.html
|
|
|
Read-Only
Author Per Westermark
Posted 7-May-2012 19:06 GMT
Toolset None
|
 RE: difference between the two #include forms
Per Westermark
If you have written code with:
lcdInit(); // LCD intialization
LCDstr("AUTOMATIC POWER",0x80);
LCDstr("METER READING",0xc0);
Then you must have picked up that "lcdInit()" or "LCDstr()"
somewhere.
That would be the place where you can also find the header files
required.
Unless you have only seen partial code somewhere and cut/pasted
without checking what you had access to. Then you have to start from
scratch and write all functions for LCD access. Or go find other code
to use instead.
But how about you start looking at the same place you originally
"found" lcdInit() and LCDstr()...
And please - do stay in one (1) thread. New threads don't give you
more answers. They only make people irritated - and irritated people
tends to ignore things that irritates them.
|
|
|
Read-Only
Author Andrew Neil
Posted 7-May-2012 20:04 GMT
Toolset None
|
 Symptomatic?
Andrew Neil
There are clear, simple instructions on how to post source code -
look at the picture: http://www.danlhenry.com/caps/keil_code.png
Since you've now started three new threads, you have managed to
miss that three times!
For any kind of programming, you really need to learn to read
documentation and pay attention to details like that!
So, as Per said, go back to wherever you found this code, and
carefully study all the documentation/instructions that
accompanied it - in particular, how to set up your project.
You will also need to study the Keil Manuals: http://www.keil.com/support/man_c51.htm
In particular, the uVision manual - which includes tutorials
showing you how to set-up a project: http://www.keil.com/support/man/docs/uv4/
More info here: http://www.keil.com/books/
|
|
|
Read-Only
Author Ashley Madison
Posted 7-May-2012 23:44 GMT
Toolset None
|
 RE: Symptomatic?
Ashley Madison
More info here:
I think your good intentions are admirable.
However, at some point, we all have to recognize that no matter
how hard we try, there will be people who are going to remain, ...,
"intellectually challenged".
That's just life, as true for you today as it was for Don Juan
DeMarco then.
so, respect the people, and respect their right to stupidity.
|
|
|
Read-Only
Author Hans-Bernhard Broeker
Posted 8-May-2012 00:13 GMT
Toolset None
|
 RE: Symptomatic?
Hans-Bernhard Broeker
there will be people who are going to remain, ...,
"intellectually challenged".
Of course. But we haven't established quite yet that this
particular specimen is a really hopeless case. There are some serious
errors in his ways, but he hasn't exhibited the tell-tale signs of
incorrigibility yet.
|
|
|
Read-Only
Author Jon Ward
Posted 9-May-2012 15:31 GMT
Toolset None
|
 RE: difference between the two #include forms
Jon Ward
This is how it works (used to work) in the Keil tools.
http://www.keil.com/support/docs/2393.htm
Jon
|
|
|
Read-Only
Author Anshik Kulshreshtha
Posted 8-May-2012 06:06 GMT
Toolset C51
|
 RE: programming is howing error
Anshik Kulshreshtha
Sir
Thank you for Building up my Confidence again
I dont have project related to these header files, this is first
project, and i want to understand each point of the programming.
Please can you help me in finding these code from some existing
projects.
Please Also Tell me the Step by Step Process to copy these codes in
the programming.
sir Please also tell me the process step wise to Create these header
files for the keil , if they are not Available.
|
|
|
Read-Only
Author Andrew Neil
Posted 8-May-2012 06:30 GMT
Toolset C51
|
 RE: help me in finding these code from some existing projects
Andrew Neil
Surely, that stuff you have posted: you must already have found
that from "some existing projects" - you haven't just written it from
scratch, have you?!
"Tell me the Step by Step Process to copy these codes in the
programming"
What you need to learn is how to program - not how to copy
code!
Just copying code is pointless if you don't understand the code -
as you are now seeing!
Tips for starting here: http://blog.antronics.co.uk/2011/08/08/
|
|
|
Read-Only
Author Tamir Michael
Posted 8-May-2012 06:31 GMT
Toolset C51
|
 RE: programming is howing error
Tamir Michael
Step by step? I believe that process is called "learning" and it
is your job - not ours. Please come back when and if you have
specific questions.
|
|
|
Read-Only
Author Hans-Bernhard Broeker
Posted 8-May-2012 21:53 GMT
Toolset C51
|
 RE: programming is howing error
Hans-Bernhard Broeker
i want to understand each point of the programming.
Hmm... doesn't look like that's true. So far you've only shown an
interest in stealing stuff you don't understand out of programs that
aren't yours, and complaining that it doesn't work.
If you want to learn how do do something, copying it
will not do you (nor anyone else) any good.
|
|
|
Read-Only
Author Anshik Kulshreshtha
Posted 9-May-2012 04:46 GMT
Toolset C51
|
 RE: programming is howing error
Anshik Kulshreshtha
Sir
This is my first time. so i dont know where to strat from .
thats why i am searching each word and try to find out the function
of each line.
just Please guide me, from where i can find out the basic for this
programming.
Thank you
|
|
|
Read-Only
Author Per Westermark
Posted 9-May-2012 08:01 GMT
Toolset C51
|
 RE: programming is howing error
Per Westermark
So if you know no programming - start writing blinky applications
or hello world applications. Don't start trying to make a LCD
project...
Do you start learning about car mechanics by stripping the engine
of a new car into pieces?
|
|
|
Read-Only
Author Anshik Kulshreshtha
Posted 9-May-2012 09:09 GMT
Toolset C51
|
 RE: programming is howing error
Anshik Kulshreshtha
Thank you sir..
|
|
|
Read-Only
Author Anshik Kulshreshtha
Posted 9-May-2012 09:49 GMT
Toolset C51
|
 RE: programming is howing error
Anshik Kulshreshtha
I have carefully read the Hello Program sir.
And with The help of those steps , I understand the process to Create
the target and how to run the program.
Thank You very much
|
|
|
Read-Only
Author Anshik Kulshreshtha
Posted 9-May-2012 09:51 GMT
Toolset C51
|
 RE: programming is howing error
Anshik Kulshreshtha
can you Please tell me some more programs to study.
|
|
|
Read-Only
Author Tamir Michael
Posted 9-May-2012 10:25 GMT
Toolset C51
|
 RE: programming is howing error
Tamir Michael
All other Keil samples!
Also, see here:
http://c-faq.com/
|
|
|
Read-Only
Author Andrew Neil
Posted 9-May-2012 19:19 GMT
Toolset None
|
 RE: Please guide me, from where i can find out the basic for this programming
Andrew Neil
I've already given you a link to a whole load of resources - did
you follow it?
|
|
|
Read-Only
Author Anshik Kulshreshtha
Posted 10-May-2012 17:28 GMT
Toolset None
|
 RE: Please guide me, from where i can find out the basic for this programming
Anshik Kulshreshtha
Sir.
On building the target a message appears like this:
Build target 'Target 1'
assembling STARTUP.A51...
compiling code.c...
C51 FATAL-ERROR - ACTION: PARSING SOURCE-FILE ERROR: PREPROCESSOR:
MACROS TOO NESTED
C51 TERMINATED.
Target not created
What does this means?
|
|
|
Read-Only
Author erik malund
Posted 10-May-2012 17:36 GMT
Toolset None
|
 RE: Please guide me, from where i can find out the basic for this programming
erik malund
C51 FATAL-ERROR - ACTION: PARSING SOURCE-FILE ERROR:
PREPROCESSOR: MACROS TOO NESTED
What does this means?
surprise! it means MACROS TOO NESTED
if you do not know what a nseted macro is then
macro a
....
endm
macro b
a // this is macro a nested
....
endm
somewhere in the docs it staes how many levels th tools can
handle, but if you go more than, say, 2 deep, your code is unreadable
anyhow
Erik
|
|
|
Read-Only
Author ashley madison
Posted 9-May-2012 12:05 GMT
Toolset C51
|
 RE: programming is howing error
ashley madison
stealing stuff you don't understand out of programs that aren't
yours,
When was last time you have stolen things that ARE yours?
|
|
|
Read-Only
Author erik malund
Posted 9-May-2012 17:01 GMT
Toolset C51
|
 quite frequently
erik malund
stolen things that ARE yours? aka code reuse
Erik
|
|