buzzer tone

For general Flowcode discussion that does not belong in the other sections.
Post Reply
siliconchip
Posts: 8
http://meble-kuchenne.info.pl
Joined: Wed Dec 16, 2020 10:38 am
Has thanked: 1 time

buzzer tone

Post by siliconchip »

HI all
im trying to generate a tone using a buzzer, ive looked through the forum and found a flowchart intended for an arduino ive changed what i think needs changing for my target chip a pic 12f1572, however i cannot workout how to output the waveform to the output and if anything requires adding id appreciate any help to get this up and running if possible, thanks in advance
bob
Attachments
Buzzer Tone.fcfx
(26.9 KiB) Downloaded 6 times

medelec35
Valued Contributor
Posts: 2207
Joined: Wed Dec 02, 2020 11:07 pm
Has thanked: 672 times
Been thanked: 751 times

Re: buzzer tone

Post by medelec35 »

Hi Bob.
The C code that was being used is only for AVR(as you correctly stated) as it's much more precise that current AVR PWM.
You will need to use the SetFrequency function of Flowcode's PWM component.
I have attached an untested example.
Note the SetFequency function should automatically set the duty to 50%
Attachments
Buzzer Tone v2.fcfx
(12.59 KiB) Downloaded 4 times
Martin

siliconchip
Posts: 8
Joined: Wed Dec 16, 2020 10:38 am
Has thanked: 1 time

Re: buzzer tone

Post by siliconchip »

hi Martin
as always thanks for the reply ive played around with it but i cant find how to output the waveform plus does it need the duty and period setting ??

cheers bob

medelec35
Valued Contributor
Posts: 2207
Joined: Wed Dec 02, 2020 11:07 pm
Has thanked: 672 times
Been thanked: 751 times

Re: buzzer tone

Post by medelec35 »

Hi Bob.
No , should not require duty or period as it should be all set automatically by the SetFequency function.
Before going any further, have you tried the one second flasher to make sure micro is running at the correct speed?
If you have then I will check the SetFrequency on a different target device
Martin

siliconchip
Posts: 8
Joined: Wed Dec 16, 2020 10:38 am
Has thanked: 1 time

Re: buzzer tone

Post by siliconchip »

Hi martin
ive not tried in hardware yet just simulation
Cheers bob

Post Reply