if you are using the hpwm command the max freq is 32767hz the min @64mhz ck is 3905 hz on a pic18
max period 256uS min 30.5uS
so you could at 50% duty get 128uS on 128uS off
if you are using the hpwm command the max freq is 32767hz the min @64mhz ck is 3905 hz on a pic18
max period 256uS min 30.5uS
so you could at 50% duty get 128uS on 128uS off
Yes, I definitely want the hardware PWM. But it's not the 50% duty that I was concerned with, it was the 1 second period.
I see now the relation between clock speed and the PWM output. So there's no way I can get it slow enough to use it as a heartbeat (1 sec period) in the background if we limitted with a 4MHz lower range.
I was hoping to use it as a debugging tool; to show that a PIC is indeed working without taking any clock cycles (disturbing cycle sensitive logic). And I wanted to try out HPWM, I'm nowhere near ready to get back on my CNC project; have to complete my residential alarm system first (and I'd like to get that interfacing with android, text messenging and web page - lots of learning).
Robert
You might, if you have one laying around, use a clock divider chip... or a counter... Here's a link that explains my thinking better than I can.
You might be able to achieve something using compare mode and the external clock pin for timer1. if you have enough spare pins and if you were really clever
use the hpwm output to drive tmr1ck then you could change the flash rate on the fly
Euh, I think I'll just get back to finishing my Charlie-plexing work for now. LOL
Thanks though, I will have to jump into PWM one day, hopefully next summer.
Robert
Hi Robert,
In your first post you say LED ON for 500uS, OFF for 500uS but then you say you want a period of 1s - that's a difference of $03E8 times.
I know you didn't want to do it with an normal interrupts but I'm going to suggest a simple timer interrupt anyway.... At such low frequencies (even though you're probably not going to get 500ms interrupt period in "on go") the interrupt processing will have very little impact on the overall performance.
/Henrik.
Hi Robert;
An HeartBeat Led should be do it with a timer interrupt like Henrik sujested....
If you cannot achieve tht time that you want, you do for instance, a 100ms interrupt and with a counter you can achieve the time that you want counting in 100ms spaces.
You can count 5 x 100ms and then toogle the led.
Thanks and Regards;
Gadelhas
Bookmarks