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

Writing to ACC with Code Optimization Level-9

This article from Keil's support knowledge database shows that one can directly write to ACC from C51 code.

http://www.keil.com/support/docs/1619.htm

I would like to know if there are any rules when writing to ACC from C code. I have noticed that the following line in my code was entirely commented out when I chose Code Optimization Level-9.


unsigned char data uDataIndex, uDataArray[5];
void main() {
   .
   .
   ACC=uDataArray[uDataIndex%5];
   .
}

Why would a compiler do this?

Parents
  • You will not have any problem if you check P right after. The mistake I made was I had another if statement placed before if (P == ...) {}. Then again, I think since the only legitimate reason to write to ACC directly is to get the parity bit, Keil perhaps should consider running a get_parity function in its intrinsic function library.

Reply
  • You will not have any problem if you check P right after. The mistake I made was I had another if statement placed before if (P == ...) {}. Then again, I think since the only legitimate reason to write to ACC directly is to get the parity bit, Keil perhaps should consider running a get_parity function in its intrinsic function library.

Children