Thanks so much for the help. I'll give this a try.
Thanks so much for the help. I'll give this a try.
If it helps for a musical instrument you can connect an old AM radio tuning capacitor across one of the crystal capacitors or across the crystal itself,
and bend the note a little. Of course you don’t have programatic control over that manual knob, but you do have infinite resolution over a range.
If you want to do portamento - "sliding notes" using HPWM and Picbasic pro, you should do it with ASM, because, PBP on each HPWM statement, resets and restarts PWM generator, which sounds additional bzzzzzzzz, while doing portamento.
If you really want to go deep into music with PIC, you should try LT8500 IC - this is 48 channel 12 bit PWM generator with fine adjustments - you can have impressive 48 voice polyphony, or say 24 voice with 2 operators per channel, or 12 with 4 operators and so on.
That's a good idea. I didn't realize there was such a device. I found the TLC5973 which has only 3 channels, which would suit my needs just fine. Not sure how well it works with PIC, but I'm sure if I look around I'll find something similar that works with SPI or I2C.
This thread is confusing. You say you want to fade the intensity of a LED and that you need to control the "fade speed". You confuse "fade speed" with PWM frequency which we've tried to explain has nothing to do with it. Then comes the ideas of using external chips, and not that the LT8500 isn't a cool chip (thanks for pointing it out!) and totally capable of dimming a LED but why on earth would you use a $6, 48 channel PWM chip in an "impossible" to breadboard 56pin QFN package, when the CCP module in the PIC you've already got is totally capable of doing what oyu want as long as you can live with 10bit resolution.
If 12bit is really needed then the TCL5973 is much more suitable. Or you can get a PIC capable of higher resolution PWM, like the 12F1571 which will do up to 16bit resolution on up to 3 channels. At 16bits though I think the frequency is getting on the low side but at 12bits you should be totally workable. Nope, HPWM won't work with it.
/Henrik.
PWM frequency, not duty cycle, has do something with fading smoothness - lower the frequency, higher the smoothness is, but flicker is more noticeable. With higher frequency, flicker is almost gone, but fading will be more ugly.
Yes with the smoothness (ie the resolution or number of available dutycycles) but not with the TIME it takes to fade the LED*
You can get a fairly high (certainly high enough to not notice any flickering) while maintaining full (10bit) resolution of the CCP module. Going below that point gives you nothing in terms of smoothness.
[*] Of course, if have a fixed delay of 10ms between duty cycles updates and then change the frequency enough to get from 8 to 10bits without changing the delay it WILL take longer to to do a full fade but THAT's pretty obvious.
/Henrik.
Bookmarks