well i probably missed something but i don't see the advantage of it. Sure Sougata will explain why.
Usually you should initialize your hardware Somewhere at the Top of your code in a way that there's no current need. Let's say your LEDs are connected on PORTB between i/o and GND, you'll use....
PORTB=0
TRISB=0
For your Piezo... use a capacitor in serie. Directly it's just Killer. It may damage your PIC one day or another. 0.1 uF or higher is good.
ANY piezo sounder have there resonant frequency, if you select the right one, 0.1-0.47 uF is enough.
Do a seah for G-Spot on this forum... yeah no kidding!
The problem with command like SOUND, PWM, FREQOUT is that you never know if the PIN is set to HIGH or LOW at the end of the cycle. In case your PIEZO is between I/O and GND AND the SOUND command leave the I/o to HIGH, your Piezo will s u c k juice from your supply 'till you disable it the right way...
SOUND Piezo, ......
LOW PIEZO
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
Bookmarks