I faithfully typed in all the I2C code from philips application notes, AN10155. I get the following when I compile in Keil:
Build target 'Target 1' assembling START900.A51... compiling demo.c... I2CEXPRT.H(65): error C141: syntax error near 'using' I2CEXPRT.H(65): error C141: syntax error near '1' DEMO.C(12): error C129: missing ';' before 'char' compiling I2CINTF.c... I2CEXPRT.H(65): error C141: syntax error near 'using' I2CEXPRT.H(65): error C141: syntax error near '1' I2CINTF.C(3): error C141: syntax error near 'char', expected ')' I2CINTF.C(5): error C129: missing ';' before 'char' compiling I2CDRIVR.C... I2CEXPRT.H(65): error C141: syntax error near 'using' I2CEXPRT.H(65): error C141: syntax error near '1' I2CDRIVR.C(19): error C141: syntax error near 'interrupt' I2CDRIVR.C(19): error C141: syntax error near '6' I2CDRIVR.C(19): error C141: syntax error near '1' I2CDRIVR.C(21): error C141: syntax error near 'STAT' I2CDRIVR.C(21): error C202: 'STAT': undefined identifier I2CDRIVR.C(23): error C172: 'case': missing enclosing switch I2CDRIVR.C(25): error C171: 'break': missing enclosing loop I2CDRIVR.C(26): error C172: 'case': missing enclosing switch I2CDRIVR.C(27): error C172: 'case': missing enclosing switch I2CDRIVR.C(30): error C171: 'break': missing enclosing loop I2CDRIVR.C(31): error C172: 'case': missing enclosing switch I2CDRIVR.C(32): error C172: 'case': missing enclosing switch Target not created
Exactly what settings must keil uVision be in in order to compile philips application notes code for AN10155?
Is this possibly just a syntax problem?
I gave your project a quick try.
There are some 'issues' with your code concerning interrupt and using, the format of the lines should be:
void Isr(void) interrupt 1 using 2
Note that the digits above are examples only.
There is one function prototype in a header file like:
extern interrupt(1) void isr(void);
The inclusion of the 'interrupt(1)' is wrong and, as far as I am aware, is not relevant to a function prototype.
There are a few instances of items like:
rom char *xxx;
The 'rom' is not a recognised C51 keyword - Maybe you have missed a define of it in your code.
There are numerous 'silly' typographical errors, especially with regards underlines - Some you appear to have missed and some you have replaced with '-'.
I would suggest that you go through the code, looking at each error from the first and correct each one in turn - You should soon then have code that at least compiles without problems.
In answer to your question: Yes I think that all errors are simple syntax errors.
Thanks for your effort. Admittedly, I was lazy. I used OCR on the philips pdf file to convert the pdf to text. It replaced a lot of underscores with dashes...I did go through it, but I'm sure I missed some. Anyway, my main concern was with "using" and "interrupt", etc. Clearly the syntax in the AN10155 file was not the same as that generated by Philips code architect...but I don't understand why it isn't able to compile as it is still C code.
"but I don't understand why it isn't able to compile as it is still C code."
Some of the code is not standard C - The using and interrupt are extensions to the language specifications and can vary between compiler vendors.
A strict ANSI compilant compiler would throw out an error if you used these extensions.
After I had compiled it, I realized that different extensions were being used...I just was unsure how to translate them.
Thanks again for your help...I should be able to get this to compile soon. I'll post a link to the finished project when I'm done. I'm going to bed now...peace out.
extern interrupt(1) void isr(void); The inclusion of the 'interrupt(1)' is wrong
not necessarily, it may very well be right for another compiler
since Ph.. NXP and Keil are fairly tight, I presume the AN is written outside NXP.
Erik
"not necessarily, it may very well be right for another compiler"
Ok, point taken.
Since this is a Keil forum and the OP mentions C51 as the architecture, I would assume that the bias was towards the Keil C51 toolset.
I'll bear it in mind for any future posts - May end up getting comments about being unnecessarily verbose ;)
Since this is a Keil forum and the OP mentions C51 as the architecture, I would assume that the bias was towards the Keil C51 toolset. absolutely; however to code was "somthing else" My post was not ment as a criticism of your post, more to illustrate that the problem might very well not be a "bad" appnote, but that the appnote was written for another compiler.
I'll bear it in mind for any future posts - May end up getting comments about being unnecessarily verbose ;) some here are very busy commenting on the format of posts rather than the contents, live with it, I do
erik
some here are very busy commenting on the format of posts rather than the contents, live with it, I do
I agree. Here are a few examples:
http://www.keil.com/forum/docs/thread8582.asp http://www.keil.com/forum/docs/thread5152.asp http://www.keil.com/forum/docs/thread6455.asp http://www.keil.com/forum/docs/thread6710.asp http://www.keil.com/forum/docs/thread10526.asp http://www.keil.com/forum/docs/thread5586.asp http://www.keil.com/forum/docs/thread7018.asp http://www.keil.com/forum/docs/thread6116.asp http://www.keil.com/forum/docs/thread6405.asp http://www.keil.com/forum/docs/thread6132.asp http://www.keil.com/forum/docs/thread5096.asp http://www.keil.com/forum/docs/thread9023.asp http://www.keil.com/forum/docs/thread8978.asp http://www.keil.com/forum/docs/thread1462.asp http://www.keil.com/forum/docs/thread6602.asp http://www.keil.com/forum/docs/thread4104.asp http://www.keil.com/forum/docs/thread6088.asp
I'm happy to see that you are not busy with a private vendetta, but always spend the majority of your time helping people.
You really ought to use some method of identifying the post and person you're replying to. Threads get a little confusing otherwise.
On the assumption it was me, I was merely pointing out to Erik that he is in fact a regular commenter on posting style, often using foul language into the bargain. While I can forgive ignorance, hypocrisy is another matter.