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
buzzer tone
-
siliconchip
- Posts: 8
- http://meble-kuchenne.info.pl
- Joined: Wed Dec 16, 2020 10:38 am
- Has thanked: 1 time
-
medelec35
- Valued Contributor
- Posts: 2207
- Joined: Wed Dec 02, 2020 11:07 pm
- Has thanked: 672 times
- Been thanked: 751 times
Re: buzzer tone
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%
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
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
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
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
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