user247026
user247026

Reputation: 3

Taylor series implementation in assembly language using 68hc11

How to implement Taylor series to calculate sine value in assembly using 68hc11.

As 68hc11 does not support floating point, display value will be in integer..(e.g. multiply by 100 to make integer value).

Upvotes: 0

Views: 1811

Answers (2)

starblue
starblue

Reputation: 56802

The Taylor series is probably not your best option. Take a look at CORDIC.

Upvotes: 0

stacker
stacker

Reputation: 68972

You might use an algorithm which does the calculation incremental, the following snippet should be easily transformed to fixpoint assembly since it makes no use of factorial and power functions. Usually it is easier to do this with lookup tables. Assembly code for 68HC11 to calculate sin(x)

double taylorSin(double x,double epsilon) {
       double result = 0.0;
       double part_n = 0.0,part=x;
       result = part;
       int i = 1;
       while ( fabs( part - part_n ) > epsilon ) {
           part_n = part;
           part = (-part*x*x) / ((2*i)*(2*i+1));
           result += part;
           i++;
       }
       return result;
}

Upvotes: 1

Related Questions