Sound frequency For Basic PRO Compiler




@ device pic16f877
define osc 4
define adc_bits 8
main:
trisb =$00
trisa =$ff
adcon1 = 7
speaker    var portb.0
sw1        var porta.0
flg_set    var bit
speaker =0
flg_set =0
while(1)
if(!sw1) then
pause 150
toggle flg_set
while(!sw1):wend       
endif    
gosub sounds                    
pause 10   
wend
end
sounds:
if(flg_set)then
pause 10
sound speaker,[100,10]'100 =(1-127 generate frequency 78.74-10 khz )
'10  = constant time 12ms/1 = 120 ms 
else
sound speaker,[0,0]  
endif  
return




READ  External interrupt For Basic PRO Compiler

Leave a Comment

*
= 5 + 0

Read previous post:
nRF24L01+ 2.4 GHz Wireless Connectivity with the tinyK20 Board
nRF24L01+ 2.4 GHz Wireless Connectivity with the tinyK20 Board

Alternatively, a USB CDC or UART (Serial) connection can be used. I’m not going much into details how to use...

Close
Scroll to top