sarang1_in
New Member
Hi all.
I am facing this problem.
If I am using following syntax, logically it is ok, but it is generating a wrong asm code via keil C51.
Problem 1
ACC = ACC + B;
This statement works fine with C.
Now I thought it will generate
ADD A, B;
but it is generating
MOV A, B;
ADD A, B;
Problem 2
this C code also involving ACC without my wish.
ACC = z;
B = 0;
if(ACC<100)
...
this is generating following asm code
MOV A, z(0X0A)
CLR A;
MOV B, A;
this is not what i want.
if I interchange the first 2 lines it works OK. Why so?
Problem 3
I want the DA A command to take place in my code after the addition what I will have to do?
As I want to convert the result in decimal and form that I want to show it on LCD. (DEC to ASCII is quite simple)
I tried lot of C code variations which show correct result as far as only C is concerned but they arte generating absurd AS code and nothing is working.
Please suggest something.
I am facing this problem.
If I am using following syntax, logically it is ok, but it is generating a wrong asm code via keil C51.
Problem 1
ACC = ACC + B;
This statement works fine with C.
Now I thought it will generate
ADD A, B;
but it is generating
MOV A, B;
ADD A, B;
Problem 2
this C code also involving ACC without my wish.
ACC = z;
B = 0;
if(ACC<100)
...
this is generating following asm code
MOV A, z(0X0A)
CLR A;
MOV B, A;
this is not what i want.
if I interchange the first 2 lines it works OK. Why so?
Problem 3
I want the DA A command to take place in my code after the addition what I will have to do?
As I want to convert the result in decimal and form that I want to show it on LCD. (DEC to ASCII is quite simple)
I tried lot of C code variations which show correct result as far as only C is concerned but they arte generating absurd AS code and nothing is working.
Please suggest something.