PDA

View Full Version : CCP1 CCP2 Accuracy?



Ramius
- 27th April 2012, 20:27
Has anyone ever checked to see how accurate the frequency is when using theHMPW command?

Acetronics2
- 27th April 2012, 21:43
Hi, Ramius

The answer is in the Pic Datasheet "CCP config in PWM mode" section ... AND thinking PBP HPWM resolution is 8 Bits ... ( 10 bits using Darrel's HPWM10 )

Alain

Ramius
- 28th April 2012, 02:03
Thank you again Alain!
I have two different "scopes" and neither will show the correct frequency. I would love to use Daniel Taylors HPWM10 and beyong the "include" I am not certain how to implement the changes :confused: I have 2 lines: "Mclk var PortB.3" and "hpwm10 1, 50, 32768". Do you change Mclk to "Mclk var long"? And if you do how do you define the port to be used? Thanks, Ed

Acetronics2
- 28th April 2012, 13:07
Hi, Ramius,

alo have a look here ... Microchip DS41214A-page 24 for high resolution PWM.



I have 2 lines: "Mclk var PortB.3" ... Do you change Mclk to "Mclk var long"?


I never heard about 32 bits PORTS on a single pin , ... to the day ...:cool-new:

I think you should learn some bits about Pics and PBP basics before trying to realize such " high level " projects ... that, friendly told. :dejection:

Alain

Ramius
- 28th April 2012, 15:34
Hi Alain!
Thank you and again in many ways you are very correct. Researching the HPWM10.PBP, I have found that even senior programmers such as BrianT have had difficulties with HWPM10 macro. When you compile your program and you have the: include "HPWM10.PBP" and then the statement: hpwm10 1, 50, 32768 the complier gives the message: Error: Macro DIV32?WW and Macro DIV32?CC not found in macro file. The statement: @ hpwm10 1, 50, 32768 does exactly the same! The DIV32 part of the error message caused me to think that a "long" was necessary. Please believe me I avoid anything that is 32 bit for as you so accurately wrote " Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ..." ;) Yes, I can call Daniel on Monday and I was hoping that there would be an answer somewhere here for me as well as others. Best, Ed

Ramius
- 28th April 2012, 21:33
Hi Alain!
Please read this as being in the kindest most friendly manner possible. Okay so I was able to resolve the issues. It turns out that HPWM10.pbp is the wrong program to use. What should be used is HPWM10L.pbp. The downside of this "include" is that debug is disabled so you have to manually re-enable it in your code if you wish your ICD to run. Now about references and spec sheets. The MS5541C spec sheet states that an accurate frequency of 32678 with a 40-60% duty cycle is required. WRONG! This duty cycle does not work! A duty cycle of 12% is about maximum. There are people such as yourself and Brian and many others who have fought and resolved these inconsistancies and errors. This is what makes this forum and people such as yourself great. We all share what we have learned the hard way! Especiall me! Lol Best wishes, Ed

Darrel Taylor
- 28th April 2012, 22:09
Ed,

You're so polite!
Even when others aren't.

I like that about you. http://www.picbasic.co.uk/forum/images/icons/icon14.png

Ramius
- 28th April 2012, 23:58
Thanks Darrel!
I have found that everyone I interact with has a very kind heart and generous soul. Even my ex-wives! Lol