Page 1 of 1
simple pizo to give me a two tone sound
Posted: Wed Jan 12, 2011 2:06 pm
by Ken Sparkes
I am trying to get a simple pizo to give me a two tone sound and, am have problems has any one got a program for flow code 4 that will help me understand.
Regards
Ken Sparkes
tigwelding@gmail.com
Re: simple pizo to give me a two tone sound
Posted: Wed Jan 12, 2011 3:56 pm
by Benj
Hello,
Pizo sounders are normally self oscillating so im not sure if you can output multiple frequencies to them. You could try hooking the Pizo up to a CCP PWM output pin and using the Flowcode PWM component to generate two distinct mark space ratios to represent your two frequencies. You may need to drive the Pizo using a transistor to boost the current.
Re: simple pizo to give me a two tone sound
Posted: Wed Jan 19, 2011 7:20 am
by Ken Sparkes
Thanks Ben that works but this is a copy from a freezer alarm that I am trying to make can you help me copy how I can get it into flow code v4alarm
movlw b'11101111'
tris gpio
movlw 010H ;max frequency
movwf maxf
movlw 040H ;min frequency
movwf nfreq
sweep0 movlw 08H
movwf times ;no. of times freq. swept
sweep1 movfw nfreq
movwf freq ;frequency being output
sweep2 bsf output ;output high
decfsz freq,f
goto sweep2
movfw nfreq
movwf freq
sweep3 bcf output ;output low
decfsz freq,f
goto sweep3
decfsz times,f
goto sweep1
decf nfreq,f
movlw maxf
xorwf nfreq,w
skpz
goto sweep0
retlw 0FFH