Electronic Projects, forums and more.

Go Back   Electronic Circuits Projects Diagrams Free > Electronics Categories > Micro Controllers


Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc.

Reply
 
Thread Tools Display Modes
Old 23rd February 2005, 03:10 PM   (permalink)
Default Keil C problem

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.
sarang1_in is offline   Reply With Quote
Old 24th February 2005, 02:05 AM   (permalink)
Default

Try writing your code in in-line assembly.
__________________
"There is no way to peace, peace is the way!"
kinjalgp is offline   Reply With Quote
Old 24th February 2005, 03:59 AM   (permalink)
Default

Yes. Thanks Kinjal. You are surely there to help all of us again.
I found that there is only way to do it.
Thanks again.
sarang1_in is offline   Reply With Quote
Old 27th February 2005, 05:05 AM   (permalink)
Default 8052.com

try posting at 8052.com also.
__________________
!!! Keep Moving !!!
dudeshan is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes




All times are GMT. The time now is 05:38 AM.


Electronic Circuits  |  Electronics Wiki
Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.