This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

expression with far variable fails (in MX)

Hallo,

now I have another serius problem.
For your information, I use:
Cx51 Ver 7.06
Philips / 89C669

An expression which involves a far variable
does not produce correct result. Here is
my test program:

#include <Philips\reg51m.h>

unsigned int result ;
unsigned int v = 25 ;
far unsigned int v2 = 25 ;

unsigned int f1 (unsigned char N)
{
	return((v * N * 2) + (v / 10)) ;
}
unsigned int f2 (unsigned char N)
{
	return((v2 * N * 2) + (v2 / 10)) ;
}
void main ()
{
	result = f1(0) ;// expected 2
	result = f1(1) ;// expected 52
	result = f1(2) ;// expected 102

	result = f2(0) ;// expected 2 (received 2)
	result = f2(1) ;// expected 52 (received 2)
	result = f2(2) ;// expected 102 (received 2)
}

Functions f1 and f2 are same except that
f1 uses v (variable in data memory) and
f2 uses v2 (far variable)
All 3 calls to f1 produce expected results.
But calls to f2 always produce the same
result 2.

Now I am very much concerned about using
the compiler for 89C669. The 2 previous
problems I wrote here (since last 2 days)
are still unanswered
http://www.keil.com/forum/docs/thread3576.asp
and
http://www.keil.com/forum/docs/thread3580.asp
I am in serius trouble now. I need to know
whether all these are my mistakes or whether
something is wrong with the compiler?
It is not possible to change the processor
now. Also I believe Keil is the only compiler
which supports (?) 89C669. Is there a chance
that I can complete this project on schedule?

If there is a moderator from Keil who is
reading this: will you please say something?


mk

0