How do you call an assembly function from C program?

前端 未结 2 797
生来不讨喜
生来不讨喜 2021-01-15 22:19

I am very new to Microcontroller programming particularly PIC18F87J11, and I am using MPLAB C18 compiler. I was reading the datasheet for various topics such as saving to me

2条回答
  •  无人及你
    2021-01-15 22:40

    There's a way to use asm in C language, depending on the compiler you use (the capacity to use asm in C is not part of the standard). Each compiler doesn't use the same syntax. With MPLAB C18 it's something like this:

    void main()
    {
         _asm
                    movlw 0x57
                    movwf PORTB
        _endasm
    }
    

    The example above is from this link, which will explain you how to use asm in C with MPLAB C18.

提交回复
热议问题