CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

ECCP Half-Bridge PWM (Hardware Issue)

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
marcusayoung



Joined: 03 Jun 2009
Posts: 28

View user's profile Send private message

ECCP Half-Bridge PWM (Hardware Issue)
PostPosted: Sun Aug 28, 2011 11:01 am     Reply with quote

Hi All,

I'm using a 16F1823 and i'm also seeing this issue with a 16F684.

I've been working with the ECCP/PWM module to generate a sine wave with some external RC filtering. The method is straight forward: I use an 8-bit LUT containing the sine wave pulse width values at a ~38kHz PWM rate. End sine wave frequency is set by how fast i index the LUT. Furthermore, the PWM is set for half-bridge mode with zero dead band delay. The code works great, i get all the functionality i expect.

The issue is that I see different DC offsets for the different polarities of P1A and P1B as set by CCP1CON[1:0] (see oscilloscope measurements below). Ideally i want the same DC offset for both pins when they are either both active high (180 degrees out of phase) or one is active high and the other active low (same phase).

CCP1CON[1:0] | Pin5 DC Offset (V) | Pin6 DC Offset (V)
0,0 | 1.43 | 3.31
0,1 | 1.43 | 1.43
1,0 | 3.31 | 3.31
1,1 | 3.31 | 1.43

PIC supply is 5V, and the PWM signaling levels also measure this. Post-filtered sine wave measures 2.86Vpp.

The method for generating this sine wave is the same for all cases, so i can only imagine that the 'output controller' (as labeled on Figure 24-5 of the PIC16F1823/PIC12F1822 datasheet) is introducing these offsets. I definitely can't have these DC offsets because it affects the gate bias of the FETs for the different polarity settings.

Any ideas? Hopefully this is just some funky register setting that i missed.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sun Aug 28, 2011 1:41 pm     Reply with quote

If you have a DC offset, one possible reason is that your positive and
negative half-cycles are not equal in amplitude and/or duration. Are you
doing something in your code, maybe with your lookup table, that could
cause this ?
marcusayoung



Joined: 03 Jun 2009
Posts: 28

View user's profile Send private message

PostPosted: Sun Aug 28, 2011 2:19 pm     Reply with quote

Ah yes!

The LUT has 256 samples, but the PWM register is 10-bits. Looks like i need more values if i want perfect compliments.
Mike Walne



Joined: 19 Feb 2004
Posts: 1785
Location: Boston Spa UK

View user's profile Send private message

PostPosted: Wed Aug 31, 2011 2:13 am     Reply with quote

What is your output sine wave frequency?

You're not giving me enough information to work on.

Can you post a short compilable program which shows the problem.

Mike
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group