Dave,
The program I wrote so far is just a simple test to generate sound (Attached). It uses the sound command like your program and it works, but I wanted to eventually use hardware PWM so that the sound was constant and not just quick 1 second bursts. I tried using FREQOUT command and it gave me errors. When I checked the documentation I noticed a bunch of commands that are not supported with 12-bit core devices including FREQOUT and ADCIN. My plan was to set registers for the HPWM so not having FREQOUT was not a big deal, but when I saw that ADCIN was nut supported I didn’t think I could use this PIC. Maybe ASCIN will work – I haven’t tried it.
Thanks,
Jim
Code:
'@__CONFIG _MCLRE_OFF & _CP_OFF & _WDT_ON & _IOFSCS_8MHZ
DEFINE OSC 8
tmr0= %00000000
ADCON0 = %000000
GPIO = %0000
TRISIO = %00111101
ANA_IN VAR GPIO.0 ' GPIO0/ANA0/PDAT
SPK VAR GPIO.1 ' GPIO1/ANA1/PCLK
Trigger VAR GPIO.2 ' GPIO2/T0CKI
' VAR GPIO.4 ' GPIO3/MCLR/VPP
Tone VAR byte
Main:
if Trigger then
'FREQOUT SPK, 20, 1000
Sound SPK,[50,1]
endif
Goto Main
End

Originally Posted by
Dave
Jim, I have attached a small program I worte a few years back for a 10F222 processor. It was for generating 2 different tones simulating a CW message for amatuer radio to be used for ID or Fox hunting purposes. It would key the radio push to talk circuit, wait 250 Milliseconds and then send the message. It would then go into a sort of sleep mode for about 6 minutes. During the sleep time it awakes approx. every 2.5 seconds and reads a port pin to see if is being commanded to transmit before the timeout period. Use it as a starting point for your project. I don't see why you couldn't use the A/D to set the tone frequency.
Bookmarks