Searching \ for '[PIC]toggle output pin from CCP module in 12F/16F.' 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=output
Search entire site for: 'toggle output pin from CCP module in 12F/16F.'.

Exact match. Not showing close matches.
PICList Thread
'[PIC]toggle output pin from CCP module in 12F/16F.'
2012\08\03@064622 by Jan-Erik Soderholm

face picon face
Hi.

Checked datasheet for 12F683 and 16F690.

In the CCP section, "Compare mode", it says :

When a match occurs, the CCP1 module may:
- Toggle the CCP1 output.      <<<===  Note!
- Set the CCP1 output.
- Clear the CCP1 output.
....
The action on the pin is based on the value of the
CCP1M<3:0> control bits of the CCP1CON register.


Now, the table for the CCP1CON register says :

1000 = Compare mode, set output on match (CCP1IF bit is set)
1001 = Compare mode, clear output on match (CCP1IF bit is set)

There is no "toggle output on match" option there

Is this a (known) datasheet error?
There is nothing in the errata documents.

Jan-Erik

2012\08\03@072054 by smith steve

flavicon
face
As far as i know the CCP is the same on most pics.... You need to change
the polirity of bit zero to sent the next edge Teh below is from a 16f1827
but i am pretty sure it works with a 690.

banksel CCP4CON     ; bank 6
btfsc CCP4CON,CCP4M0   ; check for channel or space
goto DO_SPACE    ; mark / space switch

DO_MARK
bsf  CCP4CON,CCP4M0   ; set for falling edge compare
......


DO_SPACE
bcf  CCP4CON,CCP4M0   ; set for rising edge compare



Steve
On 3 August 2012 11:46, Jan-Erik Soderholm <spam_OUTjan-erik.soderholmTakeThisOuTspamtelia.com>wrote:

{Quote hidden}

>

2012\08\03@073521 by Matt Callow

flavicon
face
What about:
0010 = Compare mode, toggle output on match (CCP1IF bit is set)
>From page 127 of 41262E.pdf

Matt

On 3 August 2012 20:46, Jan-Erik Soderholm <.....jan-erik.soderholmKILLspamspam@spam@telia.com> wrote:
{Quote hidden}

>

2012\08\03@074902 by Jan-Erik Soderholm

face picon face
OK.

It now seems as this a difference between the CCP and
the ECCP modules.

Thanks all.

Jan-Erik.



Matt Callow wrote 2012-08-03 13:35:
{Quote hidden}

>> -

2012\08\05@162434 by Jan-Erik Soderholm

face picon face
Hi again.

I wrote

> It now seems as this a difference between the CCP and
> the ECCP modules.

and I should have added :

....and an error in at least the datasheet for the
12F683 where the option "Toggle the CCP1 output"
simply is wrong.

Someone else (on a swedish electronics forum) just made a test
using the 12F683 and the option "0010" which is the toggle option
when using the *E*CCP. This *did* toggle the output pin on the
12F683, but at a fixed rate equal to the full 16 bit count
of Timer1. It could not be adjusted using the usual register
CCPR1 and/or TMR1.

So it is for practical use unusable and the docs should probably
be adjusted.

Jan-Erik.



CCP1M<3:0>: CCP Mode Select bits
0000 = Capture/Compare/PWM off (resets CCP module)
0001 = Unused (reserved)
0010 = Unused (reserved)  <<== this is the "toggle" setting on ECCP.
0011 = Unused (reserved)
0100 = Capture mode, every falling edge
0101 = Capture mode, every rising edge
0110 = Capture mode, every 4th rising edge
0111 = Capture mode, every 16th rising edge
1000 = Compare mode, set output on match (CCP1IF bit is set)
1001 = Compare mode, clear output on match (CCP1IF bit is set)
1010 = Compare mode, generate software interrupt on match.....
1011 = Compare mode, trigger special event.....
110x = PWM mode active-high
111x = PWM mode active-low

Jan-Erik Soderholm wrote 2012-08-03 13:49:
{Quote hidden}

>>> --

2012\08\06@021952 by cdb

flavicon
face
In the CCP section, "Compare mode", it says :
When a match occurs, the CCP1 module may:
- Toggle the CCP1 output.      <<<===  Note!
- Set the CCP1 output.
- Clear the CCP1 output.

The compare mode with toggle output on match is 0010 - see page 129 of PIC16F631 and family (includes the 690) DS4126D   2007.

Colin
--
cdb, EraseMEcolinspam_OUTspamTakeThisOuTbtech-online.co.uk on 6/08/2012
Web presence: http://www.btech-online.co.uk   Hosted by:  http://www.justhost.com.au
 This email is to be considered private if addressed to a named  individual or Personnel Department, and public if addressed to a blog,  forum or news article.

2012\08\06@040247 by Jan-Erik Soderholm

face picon face
Yes, I know, in those PICs that has the *ECCP* module !

But e.g. the 12F683 (with the CCP module) has the same
writing in the "Compare mode" section even if it the
0010 option does *not* work i those PICs (that is, all
PICs with the older CCP module)...

I can not see it as anything but a documentation error.

Jan-Erik.


cdb wrote 2012-08-06 08:19:
{Quote hidden}

2012\08\06@054552 by cdb

flavicon
face
On Mon, 06 Aug 2012 10:02:44 +0200, Jan-Erik Soderholm wrote:
::
:: But e.g. the 12F683 (with the CCP module) has the same
:: writing in the "Compare mode" section even if it the
:: 0010 option does *not* work i those PICs (that is, all
:: PICs with the older CCP module)...

From what i can see it has a 'manual' toggle in that it can set or clear the output on match by using 1000 and 1001 respectively.

I suppose the only way to make it toggle would be to have a flag variable that changed the CCP settings every alternate CCP1IF.

I'm looking at the 2004 edition of the datasheet and I don't see any mention of the CCP having the toggle option.

Colin

--
cdb, @spam@colinKILLspamspambtech-online.co.uk on 6/08/2012
Web presence: http://www.btech-online.co.uk   Hosted by:  http://www.justhost.com.au
 This email is to be considered private if addressed to a named  individual or Personnel Department, and public if addressed to a blog,  forum or news article.
 

2012\08\06@060423 by Jan-Erik Soderholm

face picon face


cdb wrote 2012-08-06 11:45:
> On Mon, 06 Aug 2012 10:02:44 +0200, Jan-Erik Soderholm wrote:
> ::
> :: But e.g. the 12F683 (with the CCP module) has the same
> :: writing in the "Compare mode" section even if it the
> :: 0010 option does *not* work i those PICs (that is, all
> :: PICs with the older CCP module)...
>
>   From what i can see it has a 'manual' toggle in that it can set or clear
> the output on match by using 1000 and 1001 respectively.
>
> I suppose the only way to make it toggle would be to have a flag variable
> that changed the CCP settings every alternate CCP1IF.
>
> I'm looking at the 2004 edition of the datasheet and I don't see any
> mention of the CCP having the toggle option.
>
> Colin

You did not say what version you are reading (why not?), but...

I just now downloaded the current datasheet for PIC12F683 from
Microchip, 41211D_.PDF (don't ask me what the underscore does there)
The datasheet is dated 2007, b.t.w.

On page 77, section "11.2 Compare Mode" it says:

"When a match occurs, the CCP1 module may:
- Toggle the CCP1 output.
- Set the CCP1 output.
- Clear the CCP1 output.
- Generate a Special Event Trigger.
- Generate a Software Interrupt."

I have an older version ("B", from 2004) it it says :

"When a match occurs, the GP2/AN2/T0CKI/INT/COUT/CCP1 pin is:
- Driven high
- Driven low
- Remains unchanged"


Weird...

Jan-Erik.


{Quote hidden}

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