We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hi all, as a preparatory exercise in studies I created the following source code:
#include<Euro_535.h> // Registernamen void Main (void) { int zaehler; int k; int entprellzeit; k = 0; entprellzeit=2000; while(1) { if(Taster_1=0) { for(k=0; k<entprellzeit; k++) while(Taster_1=0) zaehler++; if(zaehler>=3) { Leuchte_1=0; } } if(Taster_2=0) { zaehler=0; Leuchte_1=1; } } return; }
when translating the file, 6 errors occure and I don't know how to handle them. error 318: can't open file 'Euro_535.h' ... do I have to include the file to target? I already tried it, but it doesn't work...
errors with Taster_1 Taster_2 Leuchte_1 : undefined identifier?? ...But these variables are defined in the headerfile! so why is this error message appearing??...
I hope someone can help me clarifying these "beginners" problems.
Thank U in advance, Tom
"error 318: can't open file 'Euro_535.h'"
Does the file 'Euro_535.h' actually exist?
Is the file in folder where the tools can find it?
Do you have read permission for it?
See: http://www.keil.com/support/man/docs/c51/c51_incdir.htm http://www.keil.com/support/man/docs/c51/c51_pp_include.htm
"But these variables are defined in the headerfile! so why is this error message appearing?"
The compiler has already told you that it couldn't open the header file so, obviously, it won't know anything about any definitions in the file, will it?!
;-)
Also try:
#include "Euro_535.h"
The difference between
and
#include <Euro_535.h>
is described in http://www.keil.com/support/man/docs/c51/c51_incdir.htm
Many Thanks for "hyper"-fast answering!! Great Support!
1. with your help i was able to include the headerfile. (the problem was, that the file was in the upper folder of files belonging to this project.)
2. no i have 0 errors and 0 warnings. but when i want to debug the file in simulator: *** error56: cant open file occures! the debugger shows the correct path! what could be wrong now?
"as a preparatory exercise in studies..."
As a preparatory exercise, start here: http://www.keil.com/support/man/docs/uv3/uv3_examples.htm
ok, sorry, but i forgot "to build target"! thanks for your links, i'll keep them in mind for further problems ;-) sometimes I just need an impulse when having stuck into a problem for too long.....
Thanks for great support, CU ;-)
" forgot "to build target"!"
Ah yes - we've all done that one!
"thanks for your links, i'll keep them in mind for further problems"
I strongly suggest that you take a look at the example projects and work through them first - that way you will get a proper introduction to the tools, rather than just jumping-in blindly at the deep end!
This walks you through the whole process of editing compiling, and testing: http://www.keil.com/support/man/docs/uv3/uv3_ex_hello.htm
and the other examples are: http://www.keil.com/support/man/docs/uv3/uv3_examples.htm
Something different I spotted in your code snippet:
In some of your if and while conditions you assign values instead of comparing them.
For example in if(Taster_1=0).
Watch out for the difference between = and ==
Carsten