simple pizo to give me a two tone sound

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 4.
To post in this forum you must have a registered copy of Flowcode 4 or higher. To sign up for this forum topic please use the "Online Resources" link in the Flowcode Help Menu.

Moderator: Benj

Post Reply
Ken Sparkes
Posts: 23
Joined: Tue Nov 30, 2010 6:42 pm
Has thanked: 1 time

simple pizo to give me a two tone sound

Post 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

User avatar
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

Post 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.

Ken Sparkes
Posts: 23
Joined: Tue Nov 30, 2010 6:42 pm
Has thanked: 1 time

Re: simple pizo to give me a two tone sound

Post 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

Post Reply