Why doesn't this work??
skp run,endset ;do not execute if already running
wrax sin,0 ;set sin to 0, (acc should be zero)
sof 0,-1 ;set accum to -1
wrax cos,0 ;write to cos
endset: ;jump-to label
rdax sin,1 ;read the sin register
mulx pot0 ;multiply by pot value
rdax cos,1 ;read the cos register
wrax cos,-1 ;integrate the cos value, pass on *-1
mulx pot0 ;multiply by pot value
rdax sin,1 ;read sin reg
wrax sin,1 ;integrate the sin value
ldax sin
wrax adcl, 0
Sine generator problem.
Moderator: frank
-
- Posts: 131
- Joined: Sun Nov 15, 2009 3:37 pm
- Location: New Orleans, LA US
Re: Sine generator problem.
Here's how they do it in the example programs:
skp run,2
SOF 0,0.5 ;setup LFO with amplitude of 0.5
wrax s,0 ;c is initialized to zero on startup
rdax c,1
mulx freq
rdax s,1
wrax s,-1
mulx freq
rdax c,1
wrax c,0
You seem to have sin and cos opposite the way the example program does it. Also they load sin with .5 and presumably cos defaults to 0. You have sin as 0 and cos as -1. I don't really get the workings of this program enough to know if these differences would cause the problem, but those are the only things that look different to me.
skp run,2
SOF 0,0.5 ;setup LFO with amplitude of 0.5
wrax s,0 ;c is initialized to zero on startup
rdax c,1
mulx freq
rdax s,1
wrax s,-1
mulx freq
rdax c,1
wrax c,0
You seem to have sin and cos opposite the way the example program does it. Also they load sin with .5 and presumably cos defaults to 0. You have sin as 0 and cos as -1. I don't really get the workings of this program enough to know if these differences would cause the problem, but those are the only things that look different to me.
-
- Posts: 131
- Joined: Sun Nov 15, 2009 3:37 pm
- Location: New Orleans, LA US
Did you change the last line, "wrax c,0" to "wrax c,1" before adding your volume pot and writing to the output? Also, there will be some equates necessary that I did not show, did you add those?
The whole program is here, and it works just fine for me:
http://spinsemi.com/programs.php
The whole program is here, and it works just fine for me:
http://spinsemi.com/programs.php