Right, as Skimask says. Check up TipsTricks_41214A.pdf on the Microchip site and scroll down to the X10 carrier generation bit.
Regards,
Anand
Yes, he can get 120KHz with a standard 12MHz crystal and setting PR2 = 24. I think his problem is that he does not seem to be able to get more than 50KHz with HPWM. It may be a PBP thing, I don't know, that is why I suggested setting up the HPWM manually. With a 8Mhz clock, you can get up to 500MHz PWM, albeit with little to no resolution on the duty cycle.
I don't remember the PR2 value, but I got the same thing using a 9.6Mhz crystal.
Your solution is better though...standard crystal and supported by PBP.
PBP itself won't allow over 32Khz unless using LONG variables (PBPL 2.50), then you can (in theory) get 2Ghz out it...obviously won't happen...or will it? (see below or above whichever)I think his problem is that he does not seem to be able to get more than 50KHz with HPWM. It may be a PBP thing, I don't know
He's trying to do a square wave manually (bit high, wait, bit low, wait, repeat), bit bang the pins.
WOW! 500MHZ from 8MHZ! I want your chip!that is why I suggested setting up the HPWM manually. With a 8Mhz clock, you can get up to 500MHz PWM, albeit with little to no resolution on the duty cycle.![]()
Here is a scope trace of 500KHz HPWM using a 8MHz clock:
Horizontal is 500ns/division, Vertical is 2V/division.
OK, here is a brain teaser for you. With an 8MHz clock on a PIC16/18, what is the maximum frequency HPWM that can be achieved, and how would you do it (in terms of register values for CCPR1L and PR2)?
Hint: the answer is in the scope trace above.
Can't see the 'scope trace here (server won't let the image thru)...
In the absense of any other information (PIC type, CCP or ECCP, not that it matters), I would guess 1Mhz...
8Mhz / 4 ( crystal vs. Fosc) = 2 Mhz, but still need another cycle to set and/or reset the outputs in the CCP module, hence 1Mhz. Again, don't have enough info, nor datasheets handy.
Ski, you hit the nail on the head, 1MHz it is. I tested it in hardware and looked at the scope. It would apply to any PIC12/16/18 with either CCP or ECCP at 8MHz clock. You could get 2MHz (fFOsc) out of CLKO though.
BTW, the settings would be:
PR2 = 1
CCPR1L = 1
Bookmarks