gnupic: CCP in compare mode problem with PIC16F877


Previous by date: 8 May 2002 17:49:17 -0000 CCP in compare mode problem with PIC16F877, massimiliano ruggeri
Next by date: 8 May 2002 17:49:17 -0000 Re: CCP in compare mode problem with PIC16F877, Snail Instruments
Previous in thread: 8 May 2002 17:49:17 -0000 CCP in compare mode problem with PIC16F877, massimiliano ruggeri
Next in thread: 8 May 2002 17:49:17 -0000 Re: CCP in compare mode problem with PIC16F877, Snail Instruments

Subject: Re: CCP in compare mode problem with PIC16F877
From: Stefano ####@####.####
Date: 8 May 2002 17:49:17 -0000
Message-Id: <Pine.LNX.4.40.0205081339490.4772-100000@nietzsche.mit.edu>

Can you update to 18F252 ???
Then you might push the clock speed up to 60Mhz.


Sincerely,

Stefano Curtarolo
Massachusetts Institute of Technology
Dep. Materials Science and Engineering
MIT - Room 13-4069
77 Massachusetts Avenue
Cambridge, MA 02139-4307, USA


On Wed, 8 May 2002, massimiliano ruggeri wrote:

> Hi All,
> I have a question related to CCP modules in PIC 16F877.
>
> There is someone that use CCP modules in compare mode?
>
> I have tried to use CCP1 and CCP2 in compare mode, using
> TIMER1.
> My problem is to generate a PWM with a low period,
> impossible to reach using PWM mode and prescaler, also with a 4 MHz
> clock (and also I have a 5 K flash program, and dynamics at 1ms, then I
> would
> use a 20 MHz clock!!!).
> The frequency would be approximately 100  Hz or less.
> Then, fantastic compare mode feature, perfect for me!
>
> My problem is that if I set RC2/CCP1 = 1 and RC1/CCP2 = 1, when TIMER 1
> goes in overflow,
> after this I try to reset CCP1 pin and CCP2 pin when TIMER1 match
> respectively with
> (CCPR1H and CCPR1L) and (CCPR2H and CCPR2L) using compare mode feature,
> following the PIC16F877 manual.
>
> OK, I'm sure that:
> CCP1 and CCP2 are output (TRISC is OK).
> but:
> CCP1CON and CCP2CON are = 0x09 then (1001 - reset pin on match)
> but the pin is always 0.
>
> Note that if I use CCPxCON = 0x0A (1010 - generate interrupt on match
> and pin remain
> unchanged), and if I add in the interrput management procedure:
>
> if (CCP1IF)
> {
>     CCP1IF = 0;
>     RC2 = 0;
> }
>
> if (CCP2IF)
> {
>     CCP2IF = 0;
>     RC1 = 0;
> }
>
> then it runs, the pins switch high and low!!!!!
> No other changes in my code!!!!
> Then the match is OK and also the interrpt is OK, then the module it
> runs.
> But in this way I will use 2 interrupt more than in the previous way,
> using CCPxCON = 0x09 .........
>
> I tried also the opposite way: set pin on match and reset the pin when
> TIMER1 goes in
> overflow (inside an interrupt procedure), with CCPxCON = 0x08 set output
> on match.
>
> There is something that I don't know about CCP?
> I've read the 16F877 manual (only 1 page for CCP) and the AN594 from
> microchip site, but this don't
> helped me.
>
> Someone can help me?
>
> Thank you very much in advance.
>
> Max
>
> P.S. I have some problem in receiving the messages from the list in
> these last days......
>
> --------------
> Massimiliano Ruggeri
> CEMOTER - C.N.R.
> National Research Council Of Italy
> Fluid Power Group
> www.cemoter.bo.cnr.it
>
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ####@####.####
> For additional commands, e-mail: ####@####.####
>


Previous by date: 8 May 2002 17:49:17 -0000 CCP in compare mode problem with PIC16F877, massimiliano ruggeri
Next by date: 8 May 2002 17:49:17 -0000 Re: CCP in compare mode problem with PIC16F877, Snail Instruments
Previous in thread: 8 May 2002 17:49:17 -0000 CCP in compare mode problem with PIC16F877, massimiliano ruggeri
Next in thread: 8 May 2002 17:49:17 -0000 Re: CCP in compare mode problem with PIC16F877, Snail Instruments


Powered by ezmlm-browse 0.20.