18FXXXX PWM, 8bits are sufficient

Status
Not open for further replies.

fredfmah

Newbie level 2
Joined
Jan 18, 2013
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,306
Dear experts,
being my first time using C18 I'm not quite sure how to set the PWM to use just 8 bits of resolution.

I'm going to control a heater and the 1024steps ( 10bit), data sheet procedures would hardly be noticable as heat changes.:sad:

My objective is to do the whole loop at 8 bit level, TMR2, PR2 and ????

I`m using a 10MHz external crystal and with HS PLL gives a 10MHz Clock
To avoid audio noise my target period is 100usec, ( 1/10kHz) .

I hope I have calculated correctly ,from the above gives me a PR2 figure of d249 whigh is < 255.

Bye and thanks for any pointers
Fred

- - - Updated - - -

Dear all as I said above, this is my 1st try coding PWM in microchip C18 compiler language ( sort of C ).

I should have add a little more on the topic of 8 bits.

The period PR2 register holds an 8 bit value.
The, in my case 18F2520, datasheet holds a 10 bit value for the duty cycle.

How on earth do I compare the 10 bits to the 8 bits ?

The ways of Microchip are mysterious and only for the true followers.:shock:

Bye
Fred
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…