Sound frequency For CSS Compiler




#include <16F877.h>
#device adc=8
#FUSES NOWDT ,XT                                        
#use delay(clock=4000000)
void sound (char freq,int16 time)  // Sound Generate
{
unsigned char i;
while (time>0)
{
output_low (pin_b0);                      
for (i=1;i<=freq;i++)
time--;
output_high (pin_b0);                    
for (i=1;i<=freq;i++)
time--;
}
}
void main(){
set_tris_a(0xff);   
set_tris_b(0x00);
setup_adc_ports(NO_ANALOGS);
setup_adc(ADC_OFF);
output_b(0x00);
while(true){
if(!input(pin_a0)){    
sound(50,1000);
sound(60,5000);
sound(10,6000);     
sound(100,40000); }
else{
sound(0,0);
}
}
}




READ  Sound frequency For Basic PRO Compiler

Leave a Comment

*
= 5 + 7

Read previous post:
Building a Better RTL-SDR TCXO
Building a Better RTL-SDR TCXO

Its hard to beat the cost and versatility of the ubiquitous RTL-SDR dongles, but the temperature stability of their reference...

Close
Scroll to top