We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hi,
I need to put a statement in a interrupt routine to shift a variable right one-bit. Like this:
dat >>=1;
It generated assembly code like this:
MOV A,dat CLR C RRC A MOV dat,A
What statement in C language sould be written to complete the shift operation but not effect the "C,carry" bit?
This is to save the "PUSH PSW", "POP PSW" instruction in my ISR. The inline assembly statement is not good to me, since I am not familar with it.
Thanks, John
keep in mind that you have to save ACC if you modify it. instead of
PUSH A POP A
you can win some machine-cycles by
MOV Save_ACC,A MOV A,Save_ACC
Second hint: be sure that your instructions don't change the following PSW-bits: Carry AC OV Parity
Maybe you chould use a 1-cycle faster 8051-derivate (have a look to www.silabs.com/.../index.htm )
Dear Sven, Your advice does help me a lot. I'll take care the PSW-bits carefully to save time.