I should be able to do this, right?
<init LFO>
sin equ reg0
ldax sin
cho rdal, sin0
skp zrc sincrossing
wrax sin, 0
skp run, notcrossing
sincrossing:
etc, etc, etc.
notcrossing:
etc, etc, etc
-------------------------
Right now what it appears is happening is that the zrc is detected for fully half of the cycle.
I'll try it later tonight and post actual code example. There aren't a ton of skp zrc cases and I didn't find one yet that used the sin LFO as the source.
Thanks,
DL
Detecting zero crossings from sin LFO
Moderator: frank
-
- Posts: 338
- Joined: Mon Nov 12, 2012 1:12 pm
- Contact:
-
- Posts: 338
- Joined: Mon Nov 12, 2012 1:12 pm
- Contact:
Think I got it.
Code: Select all
equ sinreg reg0
equ output reg1
skp run, initend
wlds sin0, 111, 32767
initend:
ldax sinreg
cho rdal, sin0
skp zrc, sincrossing
wrax sinreg, 0
skp zro, nocrossing
sincrossing:
wrax sinreg, 0
ldax adcl
wrax output, 1
wrax dacr, 1
wrax dacl, 0
skp run, finish
nocrossing:
ldax output
wrax dacr, 1
wrax dacl, 0
finish:
That looks good, could save an instruction doing:
Code: Select all
equ sinreg reg0
equ output reg1
skp run, initend
wlds sin0, 111, 32767
initend:
ldax sinreg
cho rdal, sin0
skp zrc, sincrossing
wrax sinreg, 0
ldax output
wrax dacr, 1
wrax dacl, 0
skp zro, finish
sincrossing:
wrax sinreg, 0
ldax adcl
wrax output, 1
wrax dacr, 1
wrax dacl, 0
finish:
Frank Thomson
Experimental Noize
Experimental Noize
-
- Posts: 338
- Joined: Mon Nov 12, 2012 1:12 pm
- Contact:
Thanks Frank.
I could save a couple more with:
I could save a couple more with:
Code: Select all
equ sinreg reg0
equ output reg1
skp run, initend
wlds sin0, 111, 32767
initend:
ldax sinreg
cho rdal, sin0
skp zrc, sincrossing
wrax sinreg, 0
ldax output
skp run, finish
sincrossing:
wrax sinreg, 0
ldax adcl
wrax output, 1
finish:
wrax dacr, 1
wrax dacl, 0
-
- Posts: 338
- Joined: Mon Nov 12, 2012 1:12 pm
- Contact:
Hi Frank,
Somewhat esoteric question about skp zrc, x:
Suppose the waveform we are tracking is oscillating +/- around 0. But on its way from + to -, it actually lands right on zero. Then in the next cycle it goes from 0 to - something. Will the zero crossing (over two cycles) be detected or missed?
Thanks,
DL
Somewhat esoteric question about skp zrc, x:
Suppose the waveform we are tracking is oscillating +/- around 0. But on its way from + to -, it actually lands right on zero. Then in the next cycle it goes from 0 to - something. Will the zero crossing (over two cycles) be detected or missed?
Thanks,
DL
Good question, been years since I looked at that part of the circuit. If I remember correctly I am looking at a sign change so it should only fire on 0-to-negative if you hit exactly 0.
Frank Thomson
Experimental Noize
Experimental Noize