you can use the following Program to access R0 to R7 registers in Keil C
{
unsigned char R0Val;
_asm
MOV A, R0
MOV _R0Val, A
_endasm
}
OR
{
unsigned char R0Val;
#pragma ASM
MOV A, R0
MOV _R0Val, A
#pragma ENDASM
}
C variables have to be prefixed by '_' or underscore character, to be accessible in the assembly section of the C code.
Hope this helps.
Showing posts with label keil. Show all posts
Showing posts with label keil. Show all posts
Mar 5, 2010
Subscribe to:
Posts (Atom)