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
simple pizo to give me a two tone sound
Moderator: Benj
-
- Posts: 23
- Joined: Tue Nov 30, 2010 6:42 pm
- Has thanked: 1 time
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: simple pizo to give me a two tone sound
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.
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.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Posts: 23
- Joined: Tue Nov 30, 2010 6:42 pm
- Has thanked: 1 time
Re: simple pizo to give me a two tone sound
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
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