PDA

View Full Version : PBPL (Long version) + HPWM?



lilimike
- 29th April 2010, 22:30
Hi,

Could someone please clarify?

In the PBP manual at section 3.1- Usage it indicates:
"PBPL can only be used with the PIC18 devices"

In section 5.33 - PWM it indicates:
"For the non-long versions of PBP (PBP and PBPW), the highest frequency at any oscillator speed is 32767Hz.

I am using a 16F628A
Sending to the PIC this command:

HPWM 1,127,40000
Looking at the scope I observe 40.1KHz (close enough)

So does this mean there is a mistake in the manual? or does it mean I will burn my PIC shortly if I continue running at this frequency?

Thanks

Mike

lilimike
- 30th April 2010, 21:46
I guess that's a hard one to answer!
I see that PBP lets me go up to 65,535 however having a value of greater than 62000 the frequency goes down. Which I can understand with a 4MHz OSC.

I had the circuit running since yesterday with:

HPWM 1,127,60000
Which gives 62.7KHz and it is still going so I will stick with the possibility that there is a mistake in the PBP manual unless someone comes up with a better explanation.
I am using 2.60 and manual is dated 6/09.

Mike

lilimike
- 6th May 2010, 18:16
I am sorry to bring this up again but no replies from anyone is affecting my sleep.
I just need to be reassured with a confirmation that HPWM does go way past the 32767 Hz with a 16F628A contrary to what is indicated in the latest PBP book. V2.60

Because I keep reading threads about this limit that are suggesting that a miracle is happening on my bench.

I have reduced my code to this and I am reading 40.1 KHz on the scope.

@ __config _XT_OSC & _WDT_OFF & _MCLRE_ON & _LVP_OFF & _CP_OFF

DEFINE OSC 4
TRISA = $07
TRISB = $05
CMCON = $06
INTCON = $10
OPTION_REG = $C0

HPWM 1,127,40000

MAIN:
pause 1
GOTO MAIN

end

rmteo
- 6th May 2010, 18:39
Depending on the resolution required and by setting the CCP registers manually, the hardware is capable of running up into the MHz region.

lilimike
- 6th May 2010, 18:48
I have updated my code to this:

@ __config _XT_OSC & _WDT_OFF & _MCLRE_ON & _LVP_OFF & _CP_OFF

CLEAR
DEFINE OSC 4
TRISB = $05
CMCON = $07

HPWM 1,127,40000

MAIN:
pause 1
GOTO MAIN

end
I still get 40.1KHz and I have not affected CCP registers manually

rmteo
- 6th May 2010, 19:45
When working with hardware peripherals (such as CCP/PWM, USART, etc.) I will set up the registers manually - that way I know exactly what the peripheral is doing. You will also save a significant amount of code space by not having the compiler/device perform what can sometimes be pretty math intensive operations.