完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
电子发烧友论坛|
你好,
请问有一种stm8s汇编语言可以将16位二进制转换为5 bcd代码 非常感谢 marc debruyne 以上来自于谷歌翻译 以下为原文 hello, please is there a sort of stm8s assembly language available who convert a 16 bit binary to 5 bcd code many thanks marc debruyne |
|
相关推荐
3个回答
|
|
|
马克,
这是我用来计算无符号16位数量的ASCII表示的代码: .PrintU16 PUSHW X. LDW Y,#10000 DIVW X,Y LD A,XL 添加A,#'0' LDW X,Y LDW Y,#1000 DIVW X,Y SWAPW X. LDW(1,SP),X LDW X,Y LDW Y,#100 DIVW X,Y ADDW X,(1,SP) ADDW X,#'00' LDW(1,SP),X LDW X,Y LDW Y,#10 DIVW X,Y 推A LD A,XL LD YH,A POP A ADDW Y,#'00' POPW X. RET 调用者必须在X寄存器中存储要转换的数量,而在退出时,寄存器{A,X,Y}包含其ASCII表示。 我希望你会发现它很有用。 问候 EtaPhi 以上来自于谷歌翻译 以下为原文 Marc, here is the code I use to compute the ASCII representation of an unsigned 16 bit quantity: .PrintU16 PUSHW X LDW Y,#10000 DIVW X,Y LD A,XL ADD A,#'0' LDW X,Y LDW Y,#1000 DIVW X,Y SWAPW X LDW (1,SP),X LDW X,Y LDW Y,#100 DIVW X,Y ADDW X,(1,SP) ADDW X,#'00' LDW (1,SP),X LDW X,Y LDW Y,#10 DIVW X,Y PUSH A LD A,XL LD YH,A POP A ADDW Y,#'00' POPW X RET The caller must store in the X register the quantity to convert, while on exit the registers {A,X,Y} contain its ASCII representation. I hope you'll find it useful. Regards EtaPhi |
|
|
|
|
|
没有asm,但我在这里有一个双重涉猎C实现
https://sites.google.com/site/klaasdc/stm8s-projects/16bit-to-bcd-conversion 它可能会做得更好,但这是我当时所需要的。也许它对你有用。 以上来自于谷歌翻译 以下为原文 No asm, but I have a double dabble C implementation here https://sites.google.com/site/klaasdc/stm8s-projects/16bit-to-bcd-conversion It can probably be done better, but it's what I needed at the time. Maybe it's useful for you. |
|
|
|
|
|
你好先生,
非常感谢,我刚刚尝试了这个程序并且它的工作非常好; 我一定要你,你是一个聪明的人。 我找不到它,搜索了很多,并尝试从不同的处理器转换,但没有结果。所以我尝试了最后的机会来到这个论坛。 祝贺 以上来自于谷歌翻译 以下为原文 hello sir, many thanks, i have just try the program and its working very well; i must you wish ,youre a clever man. i could not find it, have search a lot, and tryed to convert from different processors, but with no result.so i have tryed the last chance to come to this forum. congratulations |
|
|
|
|
只有小组成员才能发言,加入小组>>
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的开发板烧录不了是哪里出了问题?
661浏览 5评论
710浏览 5评论
外部中断触发类型为双边沿触发,进入中断回调后有什么办法判断该边沿是上升沿还是下降沿?
941浏览 5评论
STM32L071CBT6低温环境下无法正常工作是什么原因引起的?
745浏览 5评论
/9
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2025-12-2 01:56 , Processed in 0.723348 second(s), Total 76, Slave 59 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191

淘帖
7255