大家好,我在使用16F1937处理器的C项目中遇到了一些困难。我的开发工具实际上是带有XC 8编译器V1.42,免费模式的MPLAB X V3.61。在我的项目中,刚刚从ASM移植到C,我需要一个具有16位结果的快速乘法8位×8位。就像原来的ASM项目一样。C移植完成后,由于C的缓慢乘法,我看到了一些执行延迟,只是想一个想法C函数的持续时间大约是ASM函数的2.5倍。说,我决定只用ASM中的乘法运算,现在一切都很好,但是我花了很多。在阅读大量文章和XC8用户指南的时候,在我看来,对于C代码中包含的ASM没有详细的说明。对于我来说,编写的代码不是那么“漂亮”,但实际上是找到的唯一方法,而且没有XC8C的抱怨。OMPELER。这是使用的代码,希望对其他人有用。EMANUELE。
以上来自于百度翻译
以下为原文
Hello everybody, I've had some difficul
ties using assembly code inside a C project with 16F1937 processor.
My development tool is actually MPLAB X V3.61 with XC 8 Compiler V1.42, free mode.
In my project, just now ported from asm to C, I need a fast multiplication 8 bit * 8 bit with a 16 bit result, as it was in original asm project. Once the C porting was completed, I see some delays in execution due to the slow multiplication introduced by C, just to have an idea C function has a duration of about 2.5 times asm function.
Said that, I've decided to use only multiplication in asm, and now everything works fine, but I spend a lot of time to find something that really works after reading a lot of posts and the XC8 user guide, that, in my opinion, is not properly detailed about asm included in C code.
The code written is not so 'beautiful' for me, but actually is the only way found that works and gives no complains from XC8 compiler.
This is the code used, I hope it will be useful for someone else.
Emanuele.
Attachment(s)
Multiply8by8.c (1.56 KB) - downloaded 195 times