Hi.

Well, after getting my new PIC, it didn't take long to get it going! Was a
little worried at first! I can now receive using USART and then using the values
taken put that in the PWM unit and there i have a dimming LED! Beats having a DA
and few Op-amps!

My question is about the PWM maths. I have read the datasheet but can't figure
out how to calculate the frequency of the PWM. Maybe cause its 12:30 in the
morning! Can anyone point me in the direction to an equation to figure this? It
is working, well, at first i set all the prescaller to max so got a flashing LED
rather than a dimming! So upped the pre and got a good dim! Just would like to
figure the freq.

Cheers,

Paul

# 18F4331 and PWM

Started by ●March 21, 2007

Posted by ●March 22, 2007

Hey

I have managed to figure out most of the PWM stuff but am still in need of a little help. I am using the Power Control PWM Module on the PIC18F4331, i have managed to get the frequency from the calculation on the datasheet, it wasn't 100% clear cause couldn't figure out what PTMRPS was, but it turned out to be the Prescaler! Anyway, i have tried using the PWM Resolution equation, but i can't seem to get the same answers as the example table, i have not done a lot with LOG but just used it on the calculator. I don't seem to get the correct Resolutions? Do anyone have any experience on the PWM side of this PIC? Help would be great! Cheers

----- Original Message -----

From: Paul L

To: p...

Sent: Thursday, March 22, 2007 12:40 AM

Subject: [piclist] 18F4331 and PWM

Hi.

Well, after getting my new PIC, it didn't take long to get it going! Was a little worried at first! I can now receive using USART and then using the values taken put that in the PWM unit and there i have a dimming LED! Beats having a DA and few Op-amps!

My question is about the PWM maths. I have read the datasheet but can't figure out how to calculate the frequency of the PWM. Maybe cause its 12:30 in the morning! Can anyone point me in the direction to an equation to figure this? It is working, well, at first i set all the prescaller to max so got a flashing LED rather than a dimming! So upped the pre and got a good dim! Just would like to figure the freq.

Cheers,

Paul

I have managed to figure out most of the PWM stuff but am still in need of a little help. I am using the Power Control PWM Module on the PIC18F4331, i have managed to get the frequency from the calculation on the datasheet, it wasn't 100% clear cause couldn't figure out what PTMRPS was, but it turned out to be the Prescaler! Anyway, i have tried using the PWM Resolution equation, but i can't seem to get the same answers as the example table, i have not done a lot with LOG but just used it on the calculator. I don't seem to get the correct Resolutions? Do anyone have any experience on the PWM side of this PIC? Help would be great! Cheers

----- Original Message -----

From: Paul L

To: p...

Sent: Thursday, March 22, 2007 12:40 AM

Subject: [piclist] 18F4331 and PWM

Hi.

Well, after getting my new PIC, it didn't take long to get it going! Was a little worried at first! I can now receive using USART and then using the values taken put that in the PWM unit and there i have a dimming LED! Beats having a DA and few Op-amps!

My question is about the PWM maths. I have read the datasheet but can't figure out how to calculate the frequency of the PWM. Maybe cause its 12:30 in the morning! Can anyone point me in the direction to an equation to figure this? It is working, well, at first i set all the prescaller to max so got a flashing LED rather than a dimming! So upped the pre and got a good dim! Just would like to figure the freq.

Cheers,

Paul