[sdiy] AVR/ARDUINO psuedo random noise?

dan snazelle subjectivity at hotmail.com
Wed Feb 16 18:43:21 CET 2011


found it

and my notes referring to the original tests of it

it works/worked like a charm.


sorry i forgot about your wonderful code

which is below


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;
}

On Feb 16, 2011, at 10:31 AM, Olivier Gillet wrote:

> I think you have already asked this on this list a long time back, and
> I had posted code.
> 
> On Wed, Feb 16, 2011 at 4:18 PM, dan snazelle <subjectivity at hotmail.com> wrote:
>> I am looking for advice or example code on how one might use the Arduino/AVR32 as really long shift register for digital noise.?
>> 
>> i would think it could be done, using one input for clock and another input for data and using software XORS?
>> 
>> it seems like this would be one REALLY great use for a micro would be creating interesting shift registers.
>> 
>> 
>> anyway, thanks for any links or help
>> 
>> 
>> 
>> 
>> 
>> _______________________________________________
>> Synth-diy mailing list
>> Synth-diy at dropmix.xs4all.nl
>> http://dropmix.xs4all.nl/mailman/listinfo/synth-diy
>> 
> 




More information about the Synth-diy mailing list