0
898views
Explain the use of assembly language in C language with suitable example.
1 Answer
0
3views
  • 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

    }

}
Please log in to add an answer.