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
  • Hi Juan,

    How about the following c lines? It doesn't give exactly what you want, but it should be working. Pay attention to the order of two lines and the bank you are using. I will never do that in a real project.
    BTW, why do you hate #pragma? Sometimes you have to deal with it, like or not.

    	// If you are using bank 0
    	*((unsigned char data *) 0x01) = 2;	// == MOV R1,#02H //PROGRAM DATA BYTE
    	*((unsigned char data *) 0x00) = 14;	// == MOV R0,#14 //OSC frec
    asm result in .src
    	MOV  	R0,#01H
    	MOV  	@R0,#02H
    
    	MOV  	R0,#00H
    	MOV  	@R0,#0EH
    

    Frank Hu

Reply
  • Hi Juan,

    How about the following c lines? It doesn't give exactly what you want, but it should be working. Pay attention to the order of two lines and the bank you are using. I will never do that in a real project.
    BTW, why do you hate #pragma? Sometimes you have to deal with it, like or not.

    	// If you are using bank 0
    	*((unsigned char data *) 0x01) = 2;	// == MOV R1,#02H //PROGRAM DATA BYTE
    	*((unsigned char data *) 0x00) = 14;	// == MOV R0,#14 //OSC frec
    asm result in .src
    	MOV  	R0,#01H
    	MOV  	@R0,#02H
    
    	MOV  	R0,#00H
    	MOV  	@R0,#0EH
    

    Frank Hu

Children