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

MOV RO

As a part of an "In application programming" I am using the following assembler code:

#pragma asm
MOV R0,#14 //OSC frec
MOV R1,#02H //PROGRAM DATA BYTE
#pragma endasm

I can't find the way of writing those two assembler lines in C, could anybody help me? Thanks, Juan

Parents
  • I don't know if you can define SFRs below 0x80, however you could:

    unsigned char data *ptr=0;

    ptr[0]=0xa5;
    ptr[1]=0x5a;
    etc

    but be warned that this is highly dodgy as the compiler may well be using those registers. You would need to look carefully at the generated code.

    You would be much better sticking with assembler for this IAP stuff.

    What derivative are you using?

Reply
  • I don't know if you can define SFRs below 0x80, however you could:

    unsigned char data *ptr=0;

    ptr[0]=0xa5;
    ptr[1]=0x5a;
    etc

    but be warned that this is highly dodgy as the compiler may well be using those registers. You would need to look carefully at the generated code.

    You would be much better sticking with assembler for this IAP stuff.

    What derivative are you using?

Children
  • Thanks for you reply Stefan.
    Yes I think I will keep using assembler for IAP.
    About the derivative, I am using the P89C51RD2. I rather be using Atmel (AT89C51RD2) but it is out of stock in most of the distributors. The reason I prefer Atmel over Philips is that API calls are more flexible in Atmel.
    Again, thanks.
    Juan Baez