[sdiy] Pseudo random noise circuits?

dan snazelle subjectivity at hotmail.com
Fri Sep 17 22:12:58 CEST 2010


would you mind explaining what that code means?

i appreciate it....very exciting to find something else this chip can do.


On Sep 17, 2010, at 3:27 PM, Olivier Gillet wrote:

> Outputs white noise from a 32-bits Galois LSFR, as a PWM signal on pin
> 11 of your Arduino:
> 
> #include <avr/io.h>
> #include <avr/interrupt.h>
> #include <avr/pgmspace.h>
> 
> uint32_t state = 42;
> 
> void setup() {
> pinMode(11, OUTPUT);
> TCCR2A = _BV(COM2A1) | _BV(WGM20);
> TCCR2B = _BV(CS20);
> TIMSK2 = _BV(TOIE2);
> }
> 
> void loop() { }
> 
> SIGNAL(TIMER2_OVF_vect)
> {
>  state = (state >> 1) ^ (-(state & 1) & 0xd0000001);
>  OCR2A = state & 0xff;
> }
> 




More information about the Synth-diy mailing list