Sunday, 11 November 2012

Update in pictures...


Delay ! PT2399, slightly mod'ed for reggae and dub production... Free running feedback "Emergency" toggle switch, modulation and control... LUSH !!

 LCD Back Pack and a 4046, part of a digital dubsiren based around the ATMega 328 ( Arduino Code available !)

 Initial tests to some synth stuff through midi, and of course...MIDI !!
Will be using the Pinguino board with a PIC32 at 80Mhz ...BOOM !
You even get space to add delay and all....

Proverbial Cheat sheet !!


Thursday, 8 November 2012

FRAM MCUs For Dummies sent from Mouser.




Just got this book through the mail, sent from Mouser.
If you wanna find about one of the good alternatives for low power soluitions, start here.
FRAM MCUs For Dummies shows you what FRAM is, how it works, and why it is a good choice for many modern applications.

Get your free copy here http://hu.mouser.com/framfordummies/

Wednesday, 7 November 2012

AVR MCU's C Course



Brilliant course by Brunce Land ECE - Cornell University
The link is for the whole playlist. I been using it to revise some stuff, as their website has some nice example codes as well !
He also has another one on FPGA's

Thursday, 1 November 2012

Cheat Sheet

@16 Mhz
Prescaler : 64 = Tick 4 uS
250 ticks = 1mSecond

PIC's with HITECH C Compiler...
On the newer version GODONE was changed to GO_DONE and the special function register OPTION was changed to OPTION_REG.
Decided too share as it got me stuck for a while, while studying someone else's code( which i do a lot, in order to better my programming skills and also to develop new ideas).

Thursday, 4 October 2012

Arduino Due is to finally be released on the 22nd of October




So, from Massimo's presentation at Maker Faire this weekend, the word is out that the Arduino Due is to finally be released on the 22nd of October for US $49. The board will run @ 84 Mhz based on Atmel's ARM-Cortex M3-processor based MCU (32-bit) SAM3X8E.
There are a few very neat features in the DUE, namely a USB On The Go port to allow makers and tinkerers to connect keyboards, mice, smartphones, etc...
A few DUE boards have already made it into the hands of important people in the Arduino community, it seems.

The PDF handed included:
Arduino DUE
The Arduino  Due is the newcomer  microcontroller board in the Arduino  boards  family.  lt's the first board based on a 32 bit processor  (Atmel SAM3X8E  ARM Cortex-M3  N/CU),  which improves  all the standard Arduino  functionalities  and adds manv new features.
The arduino DUE offers 54 digital input/output pins (of which 16 can be used as PWM outputs,  with selectable  resolution),  12 analog inputs with 12 bits of resolution,  4 UARTs  (hardware  serial ports), two DAC (digitalto  analog  converter)  outputs,  an 84 MHz crystal  oscillator,  two USB connections,  a power jack, an ICSP  header,  a JTAC  header,  and a reset button.
The Due has two micro USB connectors:  one intended  for debugging  purposes  and a second  one capable  of acting  as a USB  host,  allowing  external  USB peripherals  such as mouse,  keyboards,  smartphones, etc. to be connected  to the Arduino  Due.



Wednesday, 12 September 2012

Analog to digital sample code

First i bring a simple sample code on an analog to digital conversion





#include <avr/io.h>
int ADC_Read;        //Variable used to store the value read from the ADC converter
#define PB5 5
int main(void){

  DDRB |= (1<<PB5);    ///PB5/digital 13 is an output

  ADCSRA |= ((1<<ADPS2)|(1<<ADPS1)|(1<<ADPS0));    //Prescaler at 128 so we have an 125Khz clock source
  ADMUX |= (1<<REFS0);
  ADMUX &= ~(1<<REFS1);                //Avcc(+5v) as voltage reference
  ADCSRB &= ~((1<<ADTS2)|(1<<ADTS1)|(1<<ADTS0));    //ADC in free-running mode
  ADCSRA |= (1<<ADATE);                //Signal source, in this case is the free-running
  ADCSRA |= (1<<ADEN);                //Power up the ADC
  ADCSRA |= (1<<ADSC);                //Start converting

  for(;;){            //The infinite loop
    ADC_Read = ADCW;    //Read the ADC value, really that's just it
    if(ADC_Read > 512){
      PORTB |= (1<<PB5);    //If ADC value is above 512 turn led on
    }
    else {
      PORTB &= ~(1<<PB5);    //Else turn led off
    }
  }

  return 0;
}

This example demonstrates the use of the ADC of a ATmega328 
using the internal reference voltage  
To adapt to other AVR and / or other reference voltages 
see comments in this tutorial and in the data sheet




// This example demonstrates the use of the ADC of a ATmega169 
// using the internal reference voltage of nominally 1.1 V 
// To adapt to other AVR and / or other reference voltages 
// see comments in this tutorial and in the data sheet

/* Initialize the ADC */
void ADC_Init ( void )  {

  uint16_t result;

  // Select voltage reference for the ADC=> Avcc(+5v) 
  ADMUX = (1<< REFS0);
  ADMUX &= ~(1<<REFS1);                

  // Bit ADFR ("freerunning") in ADCSRA stands at power 
  // already set to 0, ie single conversion 
  ADCSRA = (1<<ADPS2)|(1<<ADPS1)|(1<<ADPS0) ;      // frequency prescaler 
  ADCSRA |= (1<<ADEN) ;                   // enable ADC

  /* After activating the ADC is a "dummy readout" recommended reading
   So a value and rejects this in order to "warm up" the ADC */

  ADCSRA |= ( 1 << ADSC ) ;                   // an ADC conversion 
  while  ( ADCSRA & ( 1 << ADSC )  )  {          // wait for the conversion is complete 
  } 
  /* ADCW must be read once, otherwise the result of the next
   Conversion is not taken. */
  result = ADCW;
}

/* ADC single measurement */
uint16_t ADC_Read (uint8_t channel) 
{ 
  // channel choose to influence without other bits 
  ADMUX = (ADMUX &~ (0xF0))|(channel &0x0F) ;
  ADCSRA |= (1<<ADSC) ;             // a  "single conversion" 
  while  (ADCSRA & (1<<ADSC) ) {    // wait for the conversion is complete 
  } 
  return ADCW;                     // ADC read and return 
}

/* ADC with multiple measurement  */
/* Note: Range of sum variables */
uint16_t ADC_Read_Avg (uint8_t channel, uint8_t nsamples) 
{ 
  uint32_t sum = 0 ;

  for  (uint8_t i = 0; i< nsamples;  i++ )  { 
    sum += ADC_Read (channel) ;
  }

  return  ( uint16_t ) ( sum/nsamples ) ;
}


/* Example calls: 
 */

int main ( ) 
{
  uint16_t adcval;
  uint16_t adcval1;
  ADC_Init ( ) ;

  while (  1  )  { 
    adcval= ADC_Read(0) ;   // channel 0 
    // do something with adcval

    adcval1= ADC_Read_Avg(2,4) ;   // Channel 2, mean of 4 measurements 
    // do something with adcval 
  } 
}

Reference (Part. 1) : http://dubworks.blogspot.co.uk/2012/08/beyond-gpio-pins-peripherals-intro-to.html