Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
robstave committed Apr 4, 2019
1 parent 3a118e4 commit 8295e6c
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 1 deletion.
33 changes: 32 additions & 1 deletion M0_Simple_Synth_04/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,35 @@

This is just a different way to do the LFO.

Basically, rather than changing the interrupt time, we speed up the timer and use a counter to tick off our actual interrupt code.
Basically, rather than changing the interrupt time, we speed up the timer and use a counter to tick off our actual interrupt code.

This sketch is pretty simple once you strip out the boiler plate.

The Interrupt is based on Timer 4.

The timer has a prescaler of 1024 which brings the timer down to 48MHz/1024 = 46.875kHz.

In addition, we are setting the compare to 500

TC4->COUNT16.CC[0].reg = 500; // Set the TC4 CC0 register as the TOP value in match frequency mode

So that brings our interrupt to 46875/500 = 93.75 hz

Now....on top of that, our code is only flipping bits when the counter is reached

if (counter > counterCompare) {
if (state % 2 == 0) {
strip.setPixelColor(0, 0, 0, 0); //set the pixel colors
} else {
strip.setPixelColor(0, 0xFF, 0, 0); //set the pixel colors
}
strip.show();
state++;
counter = 0;
}
counter++;

If the counter was 50, then we would have a frequency of 93.75 / ( 2 * 50) = 9.375 hz

If the counter was 100, then we would have a frequency of 93.75 / ( 2 * 100) = 4.688 hz
( An octave! )
10 changes: 10 additions & 0 deletions M0_Simple_Synth_05/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# M0_Simple_Synth_0

Nand Synth

So this is an approximation of the following circuit




![Capture1](https://github.com/robstave/trinketM0Synth/blob/master/M0_Simple_Synth_05/images/oneMinusLogPNG.PNG)
Binary file modified README.md
Binary file not shown.

0 comments on commit 8295e6c

Please sign in to comment.