Searching \ for '[PIC]: TMR1=external osc, ccp2=pwm, problem' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/microchip/ios.htm?key=pwm
Search entire site for: 'TMR1=external osc, ccp2=pwm, problem'.

Exact match. Not showing close matches.
PICList Thread
'[PIC]: TMR1=external osc, ccp2=pwm, problem'
2001\05\18@045206 by Vasile Surducan

flavicon
face
...a big nose coming from the swamp:

Hi there, please, may I ask a pic related question or you want to see me
behind bars...  Olin?

But first, I'm sorry I had produced a little storm with my last mail, it
wasn't my intention. However consider this potential problem:

Your boss detach you for one month in Somalia to do a pic related job.
You can't take with you anything from your office except your brain.
The Somalian government offer you a 486 on which screen you see only
c: prompter on dos3.0. If you'll don't do the job, detachment will be
definitive.
And of course your payment will be in somalian currency as medium somalian
income. What you gone do ?

Now my real problem:
I'm using the tmr1 interrupts with external oscillator for real clock,
tmr0 interrupts to debounce some buttons and ccp1 as a pwm output.
If I use only the pwm routine alone, everythink it's ok, else with
interrupts the output of PWM is sticked on high level.
Seting up CCP1 as pwm output is done exactly like data sheet say:
- setting PWM period by writting to pr2
- setting duty_cycle on ccpr1l
- set ccp1 as output
- set tmr2 prescale in t2con
- configure ccp1 for pwm
I've guess it's an interrupt problem but I can't figure out, must be
interrupts disabled when pwm is working?

Thanks, Vasile

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics


2001\05\18@090725 by Olin Lathrop

face picon face
> Your boss detach you for one month in Somalia to do a pic related job.
> You can't take with you anything from your office except your brain.
> The Somalian government offer you a 486 on which screen you see only
> c: prompter on dos3.0. If you'll don't do the job, detachment will be
> definitive.
> And of course your payment will be in somalian currency as medium somalian
> income. What you gone do ?

Go get a real job.

> I'm using the tmr1 interrupts with external oscillator for real clock,
> tmr0 interrupts to debounce some buttons and ccp1 as a pwm output.
> If I use only the pwm routine alone, everythink it's ok, else with
> interrupts the output of PWM is sticked on high level.

This could be many things.  Some part of the interrupt code has a bug such
that it stomps on the PWM state.  Did you remember to clear the interrupt
condition in the interrupt routine?  This should be easy to catch with the
simulator.  What happens to the CCP1 state to force the output high?

> I've guess it's an interrupt problem but I can't figure out,

Maybe not, could be just some other code writing where it's not supposed to,
bad bank setting, improper save/restore in the interrupt, or lots of other
possibilities.

> must be
> interrupts disabled when pwm is working?

Not at all.  The PWM interrupt can be used as a time base and as a
convenient place to reload the PWM period.  Take a look at HAL_INTR.ASPIC at
http://www.embedinc.com/pic/hal.htm.  This contains an interrupt routine
that does exactly that.


********************************************************************
Olin Lathrop, embedded systems consultant in Littleton Massachusetts
(978) 742-9014, spam_OUTolinTakeThisOuTspamembedinc.com, http://www.embedinc.com

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics


More... (looser matching)
- Last day of these posts
- In 2001 , 2002 only
- Today
- New search...