122-32000 Parallax Inc, 122-32000 Datasheet - Page 423

MANUAL PROPELLER

122-32000

Manufacturer Part Number
122-32000
Description
MANUAL PROPELLER
Manufacturer
Parallax Inc
Datasheets

Specifications of 122-32000

Accessory Type
Manual
Lead Free Status / RoHS Status
Lead free / RoHS Compliant
For Use With/related Products
Propeller Education (PE) Kit
Lead Free Status / Rohs Status
Lead free / RoHS Compliant
expnum_ret
RDWORD)
num0
table_mask
table_antilog
exp
num
Sine Table ($E000-$F001)
The sine table provides 2,049 unsigned 16-bit sine samples spanning from 0° to 90°,
inclusively (0.0439° resolution).
A small amount of assembly code can mirror and flip the sine table samples to create a full-
cycle sine/cosine lookup routine which has 13-bit angle resolution and 17-bit sample
resolution:
' Get sine/cosine
'
'
'
'
'
'
'
' on entry: sin[12..0] holds angle (0° to just under 360°)
' on exit: sin holds signed value ranging from $0000FFFF ('1') to
' $FFFF0001 ('-1')
'
getcos
getsin
getsin_ret
getcos_ret
sin_90
table index: $0000..$07FF $0800..$0001 $0000..$07FF $0800..$0001
quadrant: 1
mirror: +offset
angle: $0000..$07FF $0800..$0FFF $1000..$17FF $1800..$1FFF
flip: +sample
ret
long
long
long
long
long
add
test
test
negc
or
shl
rdword sin,sin
negnz
ret
long
$80000000
$0FFE
$C000
0
0
sin,sin_90
sin,sin_90
sin_sin_180
sin,sin
sin,sin_table
sin,#1
sin,sin
$0800
2
-offset
+sample
wc 'get quadrant 2|4 into c
wz 'get quadrant 3|4 into nz
'47..62 clocks
'(variance is due to HUB sync on
'17th bit of the mantissa
'table offset mask
'anti-log table base
'input
'output
'for cosine, add 90°
'if quadrant 2|4, negate offset
'or in sin table address >> 1
'shift left to get final word address
'read word sample from $E000 to $F000
'39..54 clocks
'(variance due to HUB sync on RDWORD)
3
+offset
-sample
'if quadrant 3|4, negate sample
Propeller Manual v1.0 · Page 423
4
-offset
-sample

Related parts for 122-32000