PWM irregularity??

Status
Not open for further replies.

fusian

New Member
i try to test my PWM output on CCP1 by sending command via USART. it works perfectly with input from 0 to 128, but when i enter 129 the voltmeter reads 0!!
surprisingly, a 255 return a max voltage of 5V...so, for my case it somehow works from 0 to 128 and 255...weird??
for your info, the detected 8bits input command from USART is directly written to CCPR1L...
 
What resolution do you have the PWM set to?, resolution is also dependent on PWM speed, the faster it runs the less resolution you have.
 
i use 20MHZ crystal , 19.53KHz PWM, 10bits resolution...but only use the MSB 8bits in CCPR1L...is this setting that cause the irregularity that i am facing??
 
Assuming you're setting it up correctly then, for a start isolate which part is giving the problem, the serial routines of the PWM - easy to do by hardcoding 129 in the program to be written to the PWM.

But it still sounds like the PWM may be set to the wrong resolution?, I would double and triple check that, and post the code here (using the 'code' tags to maintain formatting).
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…