how to store in memory keil
Pharaoh of Egypt said:
MAIN.C(11): error C272: 'asm/endasm' requires src-control to be active
MAIN.C(14): error C272: 'asm/endasm' requires src-control to be active
What is the problem ?
Since the Keil could not generate OBJ directly if you use the inline assembly.
It is needed to translate into assembly source then assemble.
As the jgorsk said, you could
set the options (generate/assemble SRC) in the project management.
As the ZeRoN said, you have to read manual for full take control the tool.
jgorsk said:
But I don't think this method of inserting
mnemonics will work
Yes, it could not work, but it could be fixed as these:
1. as the ZeRoN pointed, the parameter will be put into R7, so use "MOV A,R7" to substitute for "MOV A,#b1"
2. to use global variable to substitute for pass the parameter:
Code:
char b1;
void store( void )
{
#pragma ASM
MOV A,b1
MOV @R0,A
#pragma ENDASM
}
#define STORE(x) b1=x; store();
void main( void )
{
STORE(0xaa);
}
3. to put 'b1' into 'ACC' in C:
Code:
sfr ACC = 0xE0;
store( char b1 )
{
ACC = b1;
#pragma ASM
MOV @R0,A
#pragma ENDASM
}
void main( void )
{
store(0xaa);
}
4. as the tom324 pointed, you could handle all in C
Anyway, i just point another way to implement by inline assembly, and i think you could make it by yourself.
But the jgorsk pointed out it could not work, so i made these for more exact implementation.
Though the Keil has some bugs, its inline assembly is not strong, but works.
yager