Toll-Free Customer Support 24/7

Voice atmel code


/*
 * Project name:
   Voice Playback and Recorder Kit
 * Copyright
     (c) Researchdesignlab.com
 * Description:
    
 * Test configuration:
     MCU:             AT89S52
     Dev.Board:       8051
     Oscillator:      11.0592 MHz
     Software:        Keil uVision3

*/


#include<reg51.h>
sbit IR=P1^0;
sbit FIRE=P1^1;
sbit GAS=P1^2;

sbit RELAY1=P2^0;
sbit RELAY2=P2^1;

sbit VOICE1=P1^3;
sbit VOICE2=P1^4;
sbit VOICE3=P1^5;

void delay();

void main()
{
 
 unsigned int i,j,k,l,m,n,o,p,q,r,s,t;  

     RELAY1=0;
     RELAY2=0;
    
    
     VOICE1=0;
     VOICE2=0;
     VOICE3=0;
    
    P1=0X00;

    IR=1;
    FIRE=1;
    GAS=1;
 delay();
 delay();
 delay();
 delay();
 delay();
 delay();

while(1)
{
if(IR==1)
{
 delay();
 delay();
 delay();
 
RELAY1=1;
for(i=0;i<10;i++)
{
delay();
}
RELAY1=0;
for(j=0;j<12;j++)
{
delay();
}
RELAY2=1;
for(k=0;k<11;k++)
{
delay();
}
RELAY2=0;
for(l=0;l<25;l++)
{
delay();
}
VOICE1=1;
delay();
delay();
delay();
delay();
VOICE1=0;
delay();
delay();
delay();
delay();


}

 else if(GAS==1)
{
 delay();
 delay();
 delay();
RELAY1=1;
for(m=0;m<10;m++)
{
delay();
}
RELAY1=0;
for(n=0;n<12;n++)
{
delay();
}
RELAY2=1;
for(o=0;o<11;o++)
{
delay();
}
RELAY2=0;
for(p=0;p<25;p++)
{
delay();
}
VOICE2=1;
delay();
delay();
delay();
delay();
VOICE2=0;
delay();
delay();
delay();
delay();

}
else if(FIRE==1)
{
RELAY1=1;
for(q=0;q<10;q++)
{
delay();
}
RELAY1=0;
for(r=0;r<12;r++)
{
delay();
}
RELAY2=1;
for(s=0;s<11;s++)
{
delay();
}
RELAY2=0;
for(t=0;t<25;t++)
{
delay();
}
VOICE3=1;
delay();
delay();
delay();
delay();
VOICE3=0;
delay();
delay();
delay();
delay();

}


   }
  }
 

void delay()
{
    unsigned int X=600000000;
    while(X--);

}

  

Back to top