C and Assembler

Hi everybody.
I want to ask. I write a program in C languge, in this program I want to call a program that I wrote by assembler, when I use below it's not run. Please help me.
#pragma src(Main.asm)
#include<reg52.h>
#include<stdio.h>
#include<math.h>
#include <intrins.h>
#include <stdlib.h>

void main(void)
{
Write_Lcd();
Delay();
}
void Delay()
{
#pragma asm ; open inline-assembly block
Mov R3,#0
LoopTreDsp:
Nop
Nop
Nop
Djnz R3,LoopTreDsp
#pragma endasm
}

Parents
  • Is your source code building correctly?

    If it is, then is Write_Lcd() being invoked?

    Of course, Write_Lcd() will only be invoked once from main(). When main() attempts to return your whole system will then start-up again. You might want to do something about that by putting an infinite loop in main().

    Since the compiler will be generating a file that is passed to the assembler, it should be easy to check the assembler file to see what code is actually being generated.

Reply
  • Is your source code building correctly?

    If it is, then is Write_Lcd() being invoked?

    Of course, Write_Lcd() will only be invoked once from main(). When main() attempts to return your whole system will then start-up again. You might want to do something about that by putting an infinite loop in main().

    Since the compiler will be generating a file that is passed to the assembler, it should be easy to check the assembler file to see what code is actually being generated.

Children
More questions in this forum