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
"this would only save 2 CPU cycles compared to the approach that uses RRC."
IF your application really is so critical that this is important (which may well be the case), then you are certainly going to have to be writing parts of it in assembler - and that's not just slapping down any old assembler; that will require skilful, hand-crafted, carefully-tuned assembler.