Hi is there any way that i could insert some lines of assembly code in my code which was written in keil( C language). please tell
hi, ASM and ENDASM directives indicate the beginning of a block of source text to merge into the .SRC file. In your case: if you need with delay or long delay and you wish to write it with assembler then either create separate file with assembler code (.a51) or do it like this:
void my_delay() { #pragma asm DELAY: MOV R4,#4 DEL: MOV R2,#00F3H DJNZ R2,$ DJNZ R4,DEL #pragma endasm }
void main(void) { serial_init(); P2=0X33; #pragma asm DELAY: MOV R4,#4 DEL: MOV R2,#00F3H DJNZ R2,$ DJNZ R4,DEL RET ; <- here is the error ; because it breaks C function and returns to not defined address ; due main() is root function which is not called from anywhere.
Thanks for reply but i followed your adivce but it did'nt work. actually i want to introduce assembly code in my c program because i want to insert a calculated delay in my program. so please any body kindly either tell me the way to do it in c or tell me the way to include assembly lines in my c code. Bye
tell me the way to do it in c or tell me the way to include assembly lines in my c code. Neither Create a separate .a51 module and call the assembly code from your C Erik