68HC11的汇编代码以计算sin(x) [英] Assembly code for 68HC11 to calculate sin(x)

查看:89
本文介绍了68HC11的汇编代码以计算sin(x)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

68HC11使用泰勒级数或查找表计算正弦值的汇编代码是什么?

What would be the assembly code for 68HC11 to calculate value of sine using either Taylor series or a lookup table?

显示值只能是整数.查找表如何工作 在这种情况下?如何使用泰勒系列来实现?

Display value will be only in integer. How would a lookup table work in this case? How can it be implemented using Taylor series?

推荐答案

我没有做任何 68HC11 进行了很长时间的编程,所以我将无法为您提供确切的说明,但是您希望执行以下操作:

I haven't done any 68HC11 programming in a long time, so I won't be able to give you exact instructions, but you want to do more-or-less the following:

  1. 在内存中定义一个表,该表在一个象限内,在[0-Pi/2]范围内具有256(或更多)个Sin(x)值.
  2. 将输入转换为[0-Pi/2]范围,并跟踪其最初位于哪个象限.例如,对于Q2,您想要的值是(Pi/2-x).
  3. 在表中查找调整后的值,如果原始角度在第3象限或第4象限,则结果取反.

当然,具体取决于输入和输出范围,但是通常来说,您将使用索引寻址模式,其中索引寄存器指向表,或者使用扩展地址,通过修改操作码来设置偏移量.

Specifics would of course depend on input and output ranges, but generally speaking, you'll use indexed addressing mode, with the index register pointing into the table, or alternatively, extended addressing, with the offset set by modifying the opcode.

这篇关于68HC11的汇编代码以计算sin(x)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆