完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
扫一扫,分享给好友
|
你好
我的st7fmc需要31μs才能将两个16位变量相乘。我正在使用metrowerks编译器。我知道ÂμC很难处理16位变量,但这次对我的应用来说是不可能的。任何人都可以告诉我这是否正确或我是否有编译器设置或其他问题。 非常感谢你的帮助 最好的问候 克劳斯 以上来自于谷歌翻译 以下为原文 hello my st7fmc takes 31µs to multiplicate two 16bit variables. I'm using the metrowerks compiler. I know that it's difficult for the µC to handle 16bit variables, but this time is impossible for my application. can anyone tell me if this is right or do I have problems with compiler settings or something else. thanks a lot for your help best greetings klaus |
|
|
|
|
|
你好,
您是否尝试通过使用ASM编码从您自己的乘法运算中执行此类计算,以避免C编译器导致的过载? 问候, Tanio 以上来自于谷歌翻译 以下为原文 Hello, have you tried to perform such a computation by writing from your own the multiplication operation using ASM coding so avoiding the overload caused by the C compiler? Regards, Tanio |
|
|
|
|
|
嗨
首先,我要感谢你的帮助。 我没有尝试过在asm中进行乘法运算,因为我不习惯编程asm。我只是试着测量Âμc在几次操作中需要多长时间,并且我发现两个16位数的乘法需要花费很多时间。 我不想使用asm代码,因为没有人能够在几个月或几年内理解代码。 谢谢你的帮助 美好祝愿 克劳斯 以上来自于谷歌翻译 以下为原文 hi first i want to thank you for your help. i haven't tried to prgramm the multiplication in asm, because i'm not used to programming asm. i only have tried to measure how long the µc takes for several operations and there i found that a multiplication of two 16 bit numbers takes a lot of time. i don't want to use asm code, because no one will be able to understand the code in a few months or years. thanks for your help nice greetings klaus |
|
|
|
|
|
嗨,
无论如何,汇编程序(编译器公司)都会使用整数乘法等低级例程。 例如,以下是Cosmic的内容: ; INTEGER MULTIPLY ; COSMIC Software版权所有(c)1998 ; - X中的第一个操作数:A ; - Y中的第二个操作数和扩展名 ; xdef c_imul xref.b c_y .dcall''3,0,c_imul'' ; c_imul: 推保存LSB1 ld a,y;加载LSB2 mul x,a; H * L. ld c_y + 1,a;保存在内存中 ld x,c_y;加载MSB2 弹出一个;加载LSB1 推并保存 mul x,a; L * H. 添加a,c_y + 1;积累 ld c_y + 1,a;和商店 弹出一个;加载LSB1 ld x,y;加载LSB2 mul x,a;二 推保存LSB ld a,x;积累 添加a,c_y + 1; MSB ld x,a;到位 弹出一个;恢复LSB结果 ret;并返回 ; 结束 这是在122个周期内执行的,我想这与你测量的时间一致(只需乘以你用来检查的内部频率)。 结论是,似乎没有解决您的问题的方法。 希望这可以帮助。 问候, 卢卡 PS:如果你认为乘法很慢,甚至不要尝试除法...... 以上来自于谷歌翻译 以下为原文 Hi, low level routines such as integer multiply are wrtitten in assembler (by the compiler company) anyway. For example, here is what you get with Cosmic: ; INTEGER MULTIPLY ; Copyright (c) 1998 by COSMIC Software ; - 1st operand in X:A ; - 2nd operand in Y and extension ; xdef c_imul xref.b c_y .dcall ''3,0,c_imul'' ; c_imul: push a ; save LSB1 ld a,y ; load LSB2 mul x,a ; H * L ld c_y+1,a ; save in memory ld x,c_y ; load MSB2 pop a ; load LSB1 push a ; and save it mul x,a ; L * H add a,c_y+1 ; accumulate ld c_y+1,a ; and store pop a ; load LSB1 ld x,y ; load LSB2 mul x,a ; L * L push a ; save LSB ld a,x ; accumulate add a,c_y+1 ; MSB ld x,a ; in place pop a ; restore LSB result ret ; and return ; end this executes in 122 cycles, which, I guess, is consistent with the timing you measured (just multiply by the internal frequency you are using to check). Conclusion is, there seem to be no solution to your problem. Hope this helps. Regards, Luca PS: if you think multiplication is slow, don't even try the division... |
|
|
|
|
|
嗨,大家好,
对不起我的入侵...... 您使用的时钟频率是多少? 如果你使用8MHz,122个周期相当于大约15个......这不是太糟糕......是吗? 以上来自于谷歌翻译 以下为原文 Hi Guys, sorry for my intrusion... what is the clock frequency you are using? If you use 8MHz, 122 cycles are equivalent to about 15usec... It's not too bad..., is it? |
|
|
|
|
|
亲爱的比利诺,
欢迎致力于ST微型产品的电机控制论坛。 你的微积分似乎是正确的,当乘以16位操作数时,有效15 us秒是可以接受的。 最好的祝福, Tanio 以上来自于谷歌翻译 以下为原文 Dear Billino, welcome to the motor control forum dedicated to ST micro products. Your calculus seems correct, and effectively 15 us seconds are acceptable when multiply to 16 bits operands. Best regards, Tanio |
|
|
|
|
只有小组成员才能发言,加入小组>>
stm32mp157的异核通信的rpmsg_sdb的m4固件和a7驱动该如何编写?
1453 浏览 0 评论
stm32f103用freertos对一个采样率为1kHz的传感器,进行采样,数据出差
1502 浏览 0 评论
请教:在使用UDE STK时,单片机使用SPC560D30L1,在配置文件怎么设置或选择?里面只有SPC560D40的选项
3649 浏览 1 评论
3842 浏览 1 评论
请问是否有通过UART连接的两个微处理器之间实现双向值交换的方法?
2461 浏览 1 评论
STM32H7打开DCache后,出现了串口接收信息为空的现象,是哪里出了问题?
727浏览 5评论
用NANO STM32F103RBT6的开发板烧录不了是哪里出了问题?
663浏览 5评论
710浏览 5评论
外部中断触发类型为双边沿触发,进入中断回调后有什么办法判断该边沿是上升沿还是下降沿?
941浏览 5评论
STM32L071CBT6低温环境下无法正常工作是什么原因引起的?
745浏览 5评论
/9
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2025-12-2 07:30 , Processed in 0.871912 second(s), Total 83, Slave 67 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191

淘帖
763