Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

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...
 
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.

Latest threads

New Articles From Microcontroller Tips

Back
Top