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

Making PIC18F2620 2nd PWM work correctly...

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



Joined: 10 Nov 2003
Posts: 40
Location: Utah

View user's profile Send private message

Making PIC18F2620 2nd PWM work correctly...
PostPosted: Thu Nov 05, 2009 12:03 pm     Reply with quote

I have a hair-pulling problem:

I'm using a PIC18F2620 with both PWM's enabled in the standard (not "enhanced" mode and I have the timing/divisors set up so that all 10 bits of resolution are available (that is, PR2 = 0xFF.)

Now, PWM1 works just fine: I can throw any 10 bit value at it and it produces the expected duty cycle.

PWM2, however, has a problem: When the two LSBs of the PWM word are set to "1" (e.g. CCP2CON<5:4> = 0b11) PWM2's output flatlines at a low logic level - that' is, it stops.

Here's what I've tried:

- Using the CCS-supplied PWM functions for both configuring the hardware and setting the duty cycle.

- Writing my very own PWM functions to do the same.

- Looking at the ASM code generated by both sets of code (CCS and mine.) I've also generated code to set up both PWM1 and PWM2 and aside from the expected differences in registers being set up, the code looks the same.

In the meantime, I've simply written an exception to catch the situation where CCP2CON<5:4> = 0b11 and set it to 0b10: Not ideal, but at least it prevents the PWM output from disappearing unexpectedly!

Now, there's likely an errata about this, but I've been unable to locate anything about this, nor have I seen any mention of it elsewhere - even after trying to find it on this forum. Anyone have an idea about this?

At the moment, I have only one batch of older '2620's (probably Rev A-something) so I don't have the latest silicon Rev level - and I have the uneasy feeling that that's my answer:-)

Thanks,

CT
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Nov 05, 2009 12:09 pm     Reply with quote

What silicon rev is reported in your IDE when you "connect" your ICD to
the PIC ? In MPLAB this is given in the Output Window.
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