Singing Smiley Gadget.

Here is an other recent project, full schematic etc of a gadget that displays a smiley face on a  5×7 matrix led screen which sings along with the music around.

Circuit schematic. The potentiometer at the very right of the schematic is for testing purposes only and not present on the pcb.
component placement
PCB

U4 is a temperature sensor and not used in the current program, so its place can be left empty.

Start by soldering the jumpers first. If you forget to install them first, then it becomes impossible later. the thick jumper at the bottom only connects the leftmost pin of the switch to the right pin of J1 connector.
Component placement on PCB
Solder side and the microphone at the back.

The CCS C code is below


#include <16F88.h>
//#device ADC=8
//#use delay(clock=4000000,RESTART_WDT)
//#fuses INTRC_IO,NOWDT,NOPROTECT,NOPUT,NOBROWNOUT,NOLVP, NOMCLR

#fuses INTRC_IO,NOWDT,NOPROTECT,NOLVP, MCLR, NOPUT, NOBROWNOUT, NOFCMEN, NOIESO
#use delay(clock=8000000)



#use fast_io(B)

#rom  0x2100={0}

#define  clock pin_a0
#define  reset pin_a1

#define  tarhiz 5
#define  anaval 4

#define XTAL_FREQUENCY  8000000 
#define TIMER1_FREQUENCY (XTAL_FREQUENCY / 4) 

int32 Ticker; 
int1 flag;
int CONST TABLE [100]= {

//                  X0
                0b11111110,    
                0b11101111,
                0b11101111,
                0b11101111,
                0b11111110,
//                  X1
                0b11111110,    
                0b11101111,
                0b10111111,
                0b11101111,
                0b11111110,               
//                  X2
                0b11111110,    
                0b11101111,
                0b10101111,
                0b11101111,
                0b11111110,                
//                  X3
                0b11111110,    
                0b11101111,
                0b10110111,
                0b11101111,
                0b11111110,
//                  X4
                0b11111110,
                0b11100111,
                0b10110111,
                0b11100111,
                0b11111110,
//                  X5
                0b11111110,    
                0b10100111,
                0b10110111,
                0b10100111,
                0b11111110,
//                  X6
                0b11101110,    
                0b10110111,
                0b10110111,
                0b10110111,
                0b11101110,
//                  X7
                0b11101110,    
                0b10110111,
                0b01111011,
                0b10110111,
                0b11101110,                
//                  X8
                0b10100110,    
                0b01110111,
                0b01110111,
                0b01110111,
                0b10100110, 
//                  X9
                0b10100110,    
                0b01111011,
                0b01110111,
                0b01111011,
                0b10100110, 
//                  X10
                0b10100110,    
                0b01111011,
                0b01110011,
                0b01111011,
                0b10100110, 
//                  X11
                0b11100010,    
                0b10111011,
                0b01111011,
                0b10111011,
                0b11100010,                 
//                  X12
                0b00100010,    
                0b01111011,
                0b01111011,
                0b01111011,
                0b00100010, 
//                  X13
                0b00100010,    
                0b01111011,
                0b00101011,
                0b01111011,
                0b00100010, 
//                  X14
                0b00100010,    
                0b01110011,
                0b00111011,
                0b01110011,
                0b00100010,                 
};


#int_TIMER1                                
void TIMER1_isr()                          
{ 
  Ticker -= 565536;                        // Decrement ticker by clocks per interrupt 
  if ( Ticker < 565536 )                   // If second has expired 
  {  Ticker += TIMER1_FREQUENCY;          //   Increment ticker by clocks per second 
     flag=1;                           //   Increment number of seconds 
  } 

} 

void Initialize_RTC(void) 
{ 
  Ticker = TIMER1_FREQUENCY;                  // initialize clock counter to number of clocks per second 
  setup_timer_1( T1_INTERNAL | T1_DIV_BY_1 ); // initialize 16-bit Timer1 to interrupt 
                                              // exactly every 65536 clock cycles 
                                              // (about 76 times per second) 
  enable_interrupts( INT_TIMER1 );            // Start RTC 
} 

void main()
{

   int  sayac,index=0,index0=0,indsay=10;

   //setup_counters(RTCC_INTERNAL,RTCC_DIV_2);
   //setup_timer_1(T1_DISABLED);
   //setup_timer_2(T2_DISABLED,0,1);
   //setup_vref(FALSE);
   set_tris_B(0b10000000);   



   Initialize_RTC();
   enable_interrupts( GLOBAL );
   SETUP_ADC_PORTS(sAN6);
   


//output_B(0b11111111);
//delay_ms(1000);
   setup_adc(ADC_CLOCK_INTERNAL); 
   set_adc_channel(6);
   delay_ms(100);
   
     
   
flag=1;

while(TRUE)
{
   indsay--;


//if(anasay2 == 0){   
//   anasay2=5;
if(flag==1){
   index0=(255 - read_adc())/18;
   index = index0 *5;
   flag=0;
}
//}
//else anasay2--;

//index=20;



//delay_ms(10);
//value = read_adc();

   //for ( sayac=0 ; sayac<4 ; )
   //{
   
      
      output_A(table[index+sayac]);
      output_B(0b00000001);
      delay_ms(tarhiz);
      sayac++;
      output_A(0b11111111);


      output_A(table[index+sayac]);
      output_B(0b0000010); 
      delay_ms(tarhiz);
      sayac++;      
      output_A(0b11111111);


      output_A(table[index+sayac]);
      output_B(0b0000100); 
      delay_ms(tarhiz);
      sayac++;      
      output_A(0b11111111);            


      output_A(table[index+sayac]);
      output_B(0b0001000); 
      delay_ms(tarhiz);
      sayac++;
      output_A(0b11111111);            


      output_A(table[index+sayac]);
      output_B(0b0010000);
      delay_ms(tarhiz);
      sayac = 0;                  
      output_A(0b11111111);            


   

}
}

Social tagging:

Comments are closed.

indian porn sexnxxx.cc xvideos Amateur Porn video porno amatoriali filmeporno.top lupoporno film porno gratuit porno mature xnxx film porno gratuit
bisexuel gay porno gay porno video porno देसी सेक्स एचडी पॉर्न ऊपर ऊपर से चुदाई Големи цици only fans free porn videos filme porno gratis