0
948views
Explain the use of assembly language in C language with suitable example.
1 Answer
written 6.0 years ago by | • modified 5.9 years ago |
This is known as inline assembly which does not require separate assembly and link steps.
It is more convenient than separate a separate assembler. This uses the functions and variables of ācā language. This helps to integrate the assembly language program and ācā language program easily.
Its uses following syntax
The program
#include < reg51.h>
void main (void)
{
C Instructions;
#pragma asm
Assembly instructions
# pragma endasm
C Instructions;
}
Example ( any suitable combination)
# include < reg51.h>
void main (void)
{
while(1)
{
P0 = ~ P0;
# pragma asm
MOV TMOD,#10H
MOV TH1,#0xFFH
MOV TL1,#0xFFH
SETB TR1
JNB TF1,$
# pragma endasm
}
}