Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/c/66.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/assembly/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
mplab中汇编与C的合并_C_Assembly_Mplab - Fatal编程技术网

mplab中汇编与C的合并

mplab中汇编与C的合并,c,assembly,mplab,C,Assembly,Mplab,我想在MPLABX的c代码中使用汇编语言为PIC编写的过程。我有办法做到这一点吗。我在互联网上搜索过,但找不到任何有用的信息。如果您使用的是16位PIC,请参阅中的8.3汇编语言与C变量和函数的混合 示例8-2:在C中调用汇编函数 /* ** file: call1.c */ extern int asmFunction(int, int); int x; void main(void) { x = asmFunction(0

我想在MPLABX的c代码中使用汇编语言为PIC编写的过程。我有办法做到这一点吗。我在互联网上搜索过,但找不到任何有用的信息。

如果您使用的是16位PIC,请参阅中的8.3汇编语言与C变量和函数的混合

示例8-2:在C中调用汇编函数

   /*
    ** file: call1.c
    */
    extern int asmFunction(int, int);
    int x;
    void main(void)
    {
        x = asmFunction(0x100, 0x200);
    }
汇编语言函数对其两个参数求和并返回结果

    ;
    ; file: call2.s
    ;
      .global _asmFunction
    _asmFunction:
      add w0,w1,w0
      return
     .end
第4.12.2节“返回值”中详细介绍了传入C的参数。在前面 例如,两个整数参数在W0和W1寄存器中传递。这个 整数返回结果通过寄存器W0传输。更复杂的参数列表 可能需要不同的寄存器,在手写组件中应小心 遵循指导原则