Hello people. I'm sorry, before all, because I write a little of English.
I need to calculate the sinus (trigonometric function). This way:
-The angle will be entered by the PortB, and the sinus come back by the PortD (multiply per 100)
-The calculation will be make with a table.
-The table must have in de flash memory ( Z ?)
This is de table (DB?):
0 10 20 30 40 50 60 70 80 90 0 17 34 50 64 77 87 94 98 100 (Sinus) For example. If I have a 20 in PortB, I need that PortD have a 34.I have this code, but I don't how continue...
.INCLUDE "m8def.inc"
.DEF n = R16 .DEF suma = R17 .DEF i = R18
.ORG 0x0 rjmp inici
inici:
//ldi XH, high(2*sinus) ; high(0x60) ldi ZL, low(2*angle) ldi ZH, high(2*sinus) angle: .DB "0 10 20 30 40 50 60 70 80 90 100",0 sinus: .DB "0 17 34 50 64 77 87 94 98 100",0 in n, PINB ; take n
fi:rjmp fi
Thank you!