1000 competition !!

Started by frequencycentral/Slade, April 03, 2012, 01:39:13 PM

Previous topic - Next topic

Jdansti

  • SUPPORTER
R.G. Keene: EXPECT there to be errors, and defeat them...

Beo

Quote from: artifus on August 14, 2012, 06:43:18 PM
it really is a booby prize but is in keeping with the compo theme...

A booby prize?!! So you're saying I've got a chance!!! That's really swell Artifus!

I know this was a lot of fun (and stress) for me, and probably so for everyone else who entered. I truly spent the full three+ months working on this, and I'm making it up to my wife now (no new projects, at least until summer is over). I loved seeing all the other entries, and I'm guessing we've got a lot of observers also enjoying watching this excruciatingly long wait for a winner!

Cheers!
Travis (aka Beo)

garcho

Super impressive, dudes. Gotta say, interpreting the 'end of the world' as a place, rather than a time, was brilliant! Everyone's pedal has a long list of compliments I could give. What a crew, inspiring builds y'all!
  • SUPPORTER
"...and weird on top!"

Beo

So I've been asked by some folks for the code I used. It's messy and I'm a little embarrassed to show it. I barely finished on time, and I have not gone back to clean out crap I had in there. You have no idea how many times I pressed F7 to rebuild... I must have tripped over every mistake there is to make. Anyways, I used Peter Fleury's LCD library here:
http://homepage.hispeed.ch/peterfleury/avr-software.html

Here's my code:  :icon_redface:


/*
* Test1.c
*
* Created: 8/8/2012 5:31:25 PM
*  Author: Travis
*/
#ifndef F_CPU
#define F_CPU 1000000UL
#endif

#include <avr/io.h>
#include <avr/delay.h>
#include <string.h>
#include <stdlib.h>
#include <avr/pgmspace.h>
#include "lcd.h"
#include <avr/interrupt.h>

/*
** constant definitions
*/
static const PROGMEM unsigned char copyRightChar[] =
{
   0x07, 0x08, 0x13, 0x14, 0x14, 0x13, 0x08, 0x07,
   0x00, 0x10, 0x08, 0x08, 0x08, 0x08, 0x10, 0x00
};


volatile uint16_t T1Ovs0, T1Ovs2;         //Counts overflows
volatile uint16_t SCapt1, SCapt2, SCapt3;    //Variables holding three Scale timestamps
volatile uint16_t TCapt1, TCapt2, TCapt3;    //Variables holding three Scale timestamps
volatile uint8_t SFlag, TFlag;            //Counts number of captures
volatile uint16_t SPeriod1, SPeriod2, SPeriod3, SAvgPeriod;      //period result holders
volatile uint16_t TPeriod1, TPeriod2, TPeriod3, TAvgPeriod;      //period result holders
volatile uint8_t Flag;                    //capture Flag
volatile uint8_t ScaleSet, TempoSet, PtbEnableSet, ExecuteSet, ExecuteLatch;
volatile unsigned int i = 0;
volatile unsigned int j = 0;
volatile unsigned int k = 0;
volatile unsigned int choice = 1;
volatile uint32_t CountDown = 108;

int main(void)
{
   

   char s[sizeof("4294967295")];      // ASCII space for 32 bit number

   char buffer[5];
   char s_str_out[sizeof("12345678")] = "S:";
   char t_str_out[sizeof("12345678")] = "T:";
   char c_str_out[sizeof("12345678")] = "";
   
   // Enable Global Interrupts
   sei();
   
      DDRB = 0b1100000;  // set PB0, PB1, PB2 and PB3 to input. PB4 is LCD RW
      PORTB |= (1 << PORTB0); // set pull up
      PORTB |= (1 << PORTB1);
      PORTB |= (1 << PORTB2);
      PORTB |= (1 << PORTB3);
// PB0 Scale, pin 14
// PB1 Tempo, pin15
// PB2 PtbEnable, pin 16
// PB3 Execute, pin 17
// PB4 LCDRW, pin 18   


    PCICR |= (1 << PCIE0);     // set PCIE0 to enable PCMSK0 scan
    PCMSK0 |= (1 << PCINT0);   // set PCINT0 to trigger an interrupt on state change    
    PCMSK0 |= (1 << PCINT1); //Trigger on change of PCINT0 (PB1, Tempo)
//    PCMSK0 |= _BV(PCINT3); //Trigger on change of PCINT0 (PB3, Execute)

ScaleSet = 0;
TempoSet = 0;
PtbEnableSet = 0;
ExecuteSet = 0;
ExecuteLatch = 0;
SCapt1 = 0;
SCapt2 = 0;
SCapt3 = 0;
SPeriod1 = 0;
SPeriod2 = 0;
SPeriod3 = 0;
SAvgPeriod = 0;
TFlag = 0;
TCapt1 = 0;
TCapt2 = 0;
TCapt3 = 0;
TPeriod1 = 0;
TPeriod2 = 0;
TPeriod3 = 0;
TAvgPeriod = 0;
TFlag = 0;
TCNT0 = 0;
TCNT2 = 0;

if(bit_is_set(PINB,0))
{
ScaleSet = 1;
}
if(bit_is_set(PINB,1))
{
TempoSet = 1;
}
if(bit_is_set(PINB,2))
{
PtbEnableSet = 1;
}

if(bit_is_set(PINB,3))
{
ExecuteSet = 1;
}


//set timers
TCCR0B |= ((1 << CS00 ) | (1 << CS02 ) ); // Set up timer0 at Fcpu /1024
TCCR2B |= ((1 << CS22 ) | (1 << CS21 ) | (1 << CS20 )); // Set up timer1 at Fcpu /1024

TIMSK0 |= (1 << TOIE1 ); // Enable overflow interrupt
TIMSK2 |= (1 << TOIE1 ); // Enable overflow interrupt

    DDRD = 0b00000011;

//start lcd
   
   lcd_init(LCD_DISP_ON);
   
   lcd_clrscr();
   
   for(i=0; i<4; i++)
   {
    lcd_gotoxy(0,0); 
   lcd_puts("  ECHO\n");
   lcd_puts(" STATION");
    _delay_ms(500);
   lcd_clrscr();
   _delay_ms(300);
   }
   
   lcd_gotoxy(0,0); 
   lcd_puts("        THE DELAY INITIATIVE  ");

    for(i=0; i<30; i++)
   {
    lcd_command(LCD_MOVE_DISP_LEFT);
    _delay_ms(350);      
   }

   


   if(bit_is_set(PINB,2))
   {
      lcd_clrscr();
      for(i=0; i<4; i++)
      {
          lcd_gotoxy(0,0); 
         lcd_puts("PUSH THE");
         lcd_gotoxy(0,1);
         lcd_puts(" BUTTON ");
         _delay_ms(500);      
         lcd_clrscr();
         _delay_ms(300);
      }         
   }

             
    while(1)
    {
      // PB2 PtbEnable, pin 16
   if(bit_is_set(PINB,2)) PtbEnableSet = 1;
   if(bit_is_clear(PINB,2)) PtbEnableSet = 0;
      PORTD = 0b00000001;
      _delay_ms ( 500 );
      PORTD = 0b00000000;
      _delay_ms ( 500 );
//      if(bit_is_set(PINB,0)) j = 1;
//      if(bit_is_clear(PINB,0)) j = 0;
//      if(bit_is_set(PINB,1)) k = 1;
//      if(bit_is_clear(PINB,1)) k = 0;

   if(PtbEnableSet)
   {
      if(!ExecuteLatch)
      {
         if(CountDown>0)
         {         
            lcd_clrscr();
            lcd_gotoxy(0,0);
            lcd_puts(" T MINUS");
            lcd_gotoxy(0,1);
            if (CountDown<10)
            {
               strcpy(c_str_out,"   ");
            }
            else if (CountDown<100)
            {
               strcpy(c_str_out,"  ");
            }
            else
            {
               strcpy(c_str_out," ");
            }
            itoa(CountDown, buffer, 10);
            strcat(c_str_out,buffer);
            strcat(c_str_out," Sec");
            lcd_puts(c_str_out);
         }      
         else
         {
            lcd_clrscr();
            lcd_gotoxy(0,0);
            if (choice=1)
            {
               lcd_puts("BOOM!!! U R DEAD                                                      ");
            }
            else if (choice =2)
            {
               lcd_puts("ITS THE END OF THE WORLD AS WE KNOW IT                                ");
            }
            else if (choice =3)
            {
               lcd_puts("HE'S DEAD JIM                                                         ");
            }
            else if (choice =4)
            {
               lcd_puts("THERE WAS SUPPOSED TO BE AN EARTH SHATTERING KABOOM                   ");
            }
            else if (choice =5)
            {
               lcd_puts("ITS MADE FROM PEOPLE                                                  ");
            }
            else if (choice =6)
            {
               lcd_puts("NUKE IT FROM ORBIT                                                    ");
            }
            else if (choice =7)
            {
               lcd_puts("CONTAINMENT BREACH                                                    ");
            }
            else if (choice =8)
            {
               lcd_puts("ITS COMING FROM INSIDE THE HOUSE                                      ");
            }
            else if (choice =9)
            {
               lcd_puts("YOU WILL BE ASSIMULATED                                               ");
            }
            else if (choice =10)
            {
               lcd_puts("MCGRUBBER!!!                                                          ");
            }
            else if (choice =11)
            {
               lcd_puts("YOU MANIACS! YOU BLEW IT UP! AH, DAMN YOU! GOD DAMN YOU ALL TO HELL!  ");
            }
            else if (choice =12)
            {
               lcd_puts("ZOMBIE APOCALYPSE             ");
            }
            
            // figure out how to use strlen here

             for(i=0; i<70; i++)
            {
               lcd_command(LCD_MOVE_DISP_LEFT);
               _delay_ms(350);      
            }

            _delay_ms(5000);
            CountDown=109;
            choice++;
            if (choice > 12)
            {
               choice=1;
            }
         }
         CountDown--;
      }   
      else
      {
      CountDown = 108;   
      }
   }
   else
   {
   
      lcd_clrscr();

      lcd_gotoxy(0,0);
   
      if(TPeriod1<10){
         strcpy(t_str_out,"T:   ");
      }
      else if(TPeriod1<100)
      {
         strcpy(t_str_out,"T:  ");
      }      
      else if(TPeriod1<1000)
      {
         strcpy(t_str_out,"T: ");
      }
      else
      {
         strcpy(t_str_out,"T:");
      }
      
      itoa(TPeriod1, buffer, 10);
      strcat(t_str_out,buffer);
      strcat(t_str_out,"ms");
      lcd_puts(t_str_out);

      lcd_gotoxy(0,1);
      if(SPeriod1<10){
         strcpy(s_str_out,"S:   ");
      }
      else if(SPeriod1<100)
      {
         strcpy(s_str_out,"S:  ");
      }      
      else if(SPeriod1<1000)
      {
         strcpy(s_str_out,"S: ");
      }
      else
      {
         strcpy(s_str_out,"S:");
      }   
      itoa(SPeriod1, buffer, 10);
      strcat(s_str_out,buffer);
      strcat(s_str_out,"ms");
      lcd_puts(s_str_out);
      }
   }      
   
   
   
}


ISR(PCINT0_vect)
{

    if(bit_is_clear(PINB,0) && ScaleSet)
    {
   // Scale Pin Falling Edge
//   if(SFlag<3)   SFlag++;
//   SCapt3=SCapt2;                        // 2nd oldest timestamp
//   SCapt2=SCapt1;                        // 1st oldest timestamp
   SCapt1=TCNT0;                         // newest captured timestamp

//   SPeriod3=SPeriod2;                    // 2nd oldest period
//   SPeriod2=SPeriod1;                    // 1st oldest period
//   if(SFlag>2)
//   {
      SPeriod1=(uint16_t)(((uint32_t)(SCapt1)+ ((uint32_t)T1Ovs0*255))); //newest period
//      SAvgPeriod=(uint8_t)(((uint32_t)(SCapt1)+ (uint32_t)(SCapt2)+ (uint32_t)(SCapt3))/ 0x11L);
//   }
   T1Ovs0=0;                           //reset overflows
   ScaleSet = 0;
   TCNT0 = 0;
    }
   

    if(bit_is_clear(PINB,1) &&TempoSet)
    {
   // Tempo Pin Falling Edge
//   if(TFlag<3)   TFlag++;

//   TCapt3=TCapt2;                        // 2nd oldest timestamp
//   TCapt2=TCapt1;                        // 1st oldest timestamp
   TCapt1=TCNT2;                         // newest captured timestamp
//   TPeriod3=TPeriod2;                    // 2nd oldest period
//   TPeriod2=TPeriod1;                    // 1st oldest period
//   if(TFlag>2)
//   {
      TPeriod1=(uint16_t)(((uint32_t)(TCapt1)+ ((uint32_t)T1Ovs2*255))); //newest period
//      TAvgPeriod=(uint8_t)(((uint32_t)(TCapt1)+ (uint32_t)(TCapt2)+ (uint32_t)(TCapt3))/ 0x11L);
//   }
   T1Ovs2=0;                           //reset overflows
   TempoSet = 0;
   TCNT2=0;
    }

    if(bit_is_set(PINB,3))
   {
      ExecuteSet=1;
   }      

    if(bit_is_clear(PINB,3)&&!ExecuteLatch)
    {
      // Execute Latch
      ExecuteLatch = 1;
      if(PtbEnableSet)
      {
         lcd_clrscr();
         lcd_gotoxy(0,0);
         lcd_puts("EXECUTE!");
         lcd_gotoxy(0,1);
         lcd_puts("        ");
      }         
    }
        
   if(bit_is_set(PINB,0))
    {
      // Scale Pin set
      ScaleSet = 1;
    }
 
    if(bit_is_set(PINB,1))
    {
      // Tempo Pin set
      TempoSet = 1;
    }
    if(bit_is_set(PINB,3))
    {
      // Remove Execute Latch
      ExecuteLatch = 0;
   }
}


ISR ( TIMER0_OVF_vect )
{
T1Ovs0++;
TCNT0=0;
}

ISR ( TIMER2_OVF_vect )
{
T1Ovs2++;
TCNT2=0;
}

pakrat

Quote from: Beo on August 16, 2012, 02:12:44 AM
               lcd_puts("YOU MANIACS! YOU BLEW IT UP! AH, DAMN YOU! GOD DAMN YOU ALL TO HELL!  ");
            

....Nice  :icon_biggrin:

Jdansti

Quote from: pakrat on August 16, 2012, 10:54:18 AM
Quote from: Beo on August 16, 2012, 02:12:44 AM
               lcd_puts("YOU MANIACS! YOU BLEW IT UP! AH, DAMN YOU! GOD DAMN YOU ALL TO HELL!  ");
            

....Nice  :icon_biggrin:

  • SUPPORTER
R.G. Keene: EXPECT there to be errors, and defeat them...

artifus


deadastronaut

https://www.youtube.com/user/100roberthenry
https://deadastronaut.wixsite.com/effects

chasm reverb/tremshifter/faze filter/abductor II delay/timestream reverb/dreamtime delay/skinwalker hi gain dist/black triangle OD/ nano drums/space patrol fuzz//

Govmnt_Lacky

Is there any word on a decision?

Pretty soon I will need to start chewing my neighbor's nails  :icon_eek:

;D
A Veteran is someone who, at one point in his or her life, wrote a blank check made payable to The United States of America
for an amount of 'up to and including my life.'

Jdansti

Quote from: Govmnt_Lacky on August 16, 2012, 05:24:53 PM
Is there any word on a decision?

Pretty soon I will need to start chewing my neighbor's nails  :icon_eek:

;D

Just don't chew on Rob's weenie.  :-\
  • SUPPORTER
R.G. Keene: EXPECT there to be errors, and defeat them...

Quackzed

ew, it looks like somebody already did...  :-X
nothing says forever like a solid block of liquid nails!!!

Govmnt_Lacky

Quote from: Jdansti on August 16, 2012, 05:31:42 PM
Quote from: Govmnt_Lacky on August 16, 2012, 05:24:53 PM
Is there any word on a decision?

Pretty soon I will need to start chewing my neighbor's nails  :icon_eek:

;D

Just don't chew on Rob's weenie.  :-\

Remember.... Rob is from the UK

I believe they are "bangers" not weenies!!  ;D

And NO..... I limit my anxiety over waiting long periods of time for decisions to just finger nails ;)
A Veteran is someone who, at one point in his or her life, wrote a blank check made payable to The United States of America
for an amount of 'up to and including my life.'

cloudscapes

seeing everybody's entries and how they work is prize enough!  :o

yeah yeah, awwwwwwwwwwwkitchcheesyfauxhumble  ;)
~~~~~~~~~~~~~~~~~~~~~~
{DIY blog}
{www.dronecloud.org}

Beo

I ran out of time, but I though of submitting a second entry using the other interesting Hammond enclosure I got... its the trapezoidal shaped box, the 1590TRPB. I never did decide on a circuit, but my idea was to make it a demon head with horns extending from the top fat side. It would be cool if I could custom make curved pedalboard cables/plugs shaped like the horns, and red glow knob-eyes.


pakrat

@Beo Maybe you can still do that, would be interesting to see. By the way, I think your DHARMA pedal is awesome! It makes me want to watch Lost all over again.

haveyouseenhim

It would be awesome if u make it look like the robot devil from Futurama.

  • SUPPORTER
http://www.youtube.com/haveyouseenhim89

I'm sorry sir, we only have the regular ohms.

pakrat


Beo

Quote from: haveyouseenhim on August 17, 2012, 01:33:58 AM
It would be awesome if u make it look like the robot devil from Futurama.

That's so great! A robot devil!!!

@pakrat, thanks, I'm glad you liked the theme. It fits the hexagon so well.

diydave

Looking at all this stuff...  :o man, I'm nowhere near this level of expertise.
Great work! Me jealous.

Leston Braun

#499
Quote from: Beo on August 17, 2012, 12:20:26 AM
I ran out of time, but I though of submitting a second entry using the other interesting Hammond enclosure I got... its the trapezoidal shaped box, the 1590TRPB. I never did decide on a circuit, but my idea was to make it a demon head with horns extending from the top fat side. It would be cool if I could custom make curved pedalboard cables/plugs shaped like the horns, and red glow knob-eyes.


Mine is built into the "BB" version of that trapezoid case, the picture is just taken a bit too close for it to appear properly.

It also occurred to me that Skeeter Davis might not be known in every corner of the world, and the joke might left unnoticed, so here is Skeeter singing her best known song..




edit. And gongratulations to everyone, your pedals look awesome, my shoulders kept on sinking every time a new contestant was posted.