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

Write R7 register directly from C

I use KeilC uVision4 for 89C51 MCU.
By "Inline ASM", i can easily direct write value to R7 register, like this :

    #pragma ASM
        MOV R7, #10
    #pragma ENDASM


But now, there are some reason that i have to write to R7 register direct from C (not from inline ASM), eg:

    R7 = 10;


Of course, the C compiler does not understand R7 as MCU Register (not Inline ASM).

-> Is there anyway to solve this problem. Please help me if anyone know, thanks a lot !

Parents
  • if at least 2 experienced people are telling you
    DON'T DO IT! and you refuse and insist on doing it your way, when it is clear even to a non-C51 guy like me that what you are doing is plain wrong, then you are no less than a ticking bomb. have you even considered that your "time gain" will be nullified by the hoops the processor will have to jump through in order to compensate for your macroed assembly...?

Reply
  • if at least 2 experienced people are telling you
    DON'T DO IT! and you refuse and insist on doing it your way, when it is clear even to a non-C51 guy like me that what you are doing is plain wrong, then you are no less than a ticking bomb. have you even considered that your "time gain" will be nullified by the hoops the processor will have to jump through in order to compensate for your macroed assembly...?

Children