Hi Rob,
Thank you for trying to help me.
Yes it's necessary to enabling INTCON_PEIE. It is what I did with INTCON =
0b_1100_0000.
The mystery is elsewhere

<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
Garanti
sans virus. www.avast.com
<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>

Le lun. 27 juil. 2020 à 21:42, Rob CJ <[email protected]> a écrit :

> Hi Michel,
>
> Maybe I was too quick. You mentioned that you have connected something to
> A2 so I assume you use the external interrupt.
>
> Next to that you are using a comparator which is a peripheral device.
>
> This means that you also have to enable interrupts from peripheral devices
> by enabling those interrupts with: INTCON_PEIE = TRUE
>
> Kind regards,
>
> Rob
>
> ------------------------------
> *Van:* Rob CJ <[email protected]>
> *Verzonden:* maandag 27 juli 2020 21:38
> *Aan:* [email protected] <[email protected]>
> *Onderwerp:* Re: [jallib] PIC12F675 INTERRUPT WITH COMPARATOR OUTPUT
> CHANGING doesn't work
>
> Hello Michel,
>
> If you want to use the external interrupt you have to enable it by:
> INTCON_INTE = TRUE
>
> Initially it is disabled by default.
>
> Kind regard,
>
> Rob
>
> ------------------------------
> *Van:* [email protected] <[email protected]> namens Michel
> MORICE <[email protected]>
> *Verzonden:* maandag 27 juli 2020 12:06
> *Aan:* jallib <[email protected]>
> *Onderwerp:* [jallib] PIC12F675 INTERRUPT WITH COMPARATOR OUTPUT CHANGING
> doesn't work
>
> Hi
> On a PIC12F675 I use A0 and A1 as analogic input to control the light of
> the day to open/close a door
> A2 as logic output with a led to control the right operating.
> An interrupt on A2 changing should start the process but that doesn't work.
> Hereafter a little program to try the function.
> Thanks for helping me.
>
> --************************************************************************
> --****** Programme POULE2  -Ouverture crépusculaire du poulailler ********
> --***************************************Michel MORICE 16 juillet 2020****
> include 12f675
> pragma target clock 4_000_000
> pragma target OSC INTOSC_NOCLKOUT  -- horloge interne à 4 MHz
> pragma target MCLR internal        -- make MCLR pin A3 available as I/O
> pragma target WDT disabled
> --conditionnement du PIC
> ANSEL  = 0b_0000_0011  --ports 0 et 1 en analogique, entrées du comparateur
> TRISIO = 0b_0000_1011  --ports 0, 1, 3 en input, 2, 4 et 5 en output
> CMCON  = 0b_0000_0001  --comparateur + en 0, - en 1, sortie en 2
> PIE1   = 0b_0000_1000  --comparateur enable bit
> INTCON = 0b_1100_0000  --global interrupt et peripheral interrupt
> --paramétrage des portes
> alias COMPS is pin_A2   --sortie du comparateur
> alias ILS is pin_A3     --ILS contrôlant la fermeture de porte
> alias OUVRE is pin_A4   --commande l'ouverture
> alias FERME is pin_A5   --commande la fermeture
> --paramétrage général
> --ON OFF TRUE FALSE définis par include 12f675 et constants_jallib
> const dword seconde = 1_000_000
> const bit OUVERTE = ON
> const bit FERMEE  = OFF
> var bit changeLum = FALSE
> --***************************************************************
> --****************************************************************
> procedure changeLuminosite() is pragma INTERRUPT
>   if PIR1_CMIF then     --changement de luminosité détecté
>     changeLum = TRUE
>   end if
> end procedure
> --****************************************************************
> --programme principal
> forever loop
>   if changeLum then
>     PIR1_CMIF = OFF
>     INTCON_GIE = OFF
>     OUVRE = ON
>     _usec_delay(seconde * 3)
>     OUVRE = OFF
>   end if
>   INTCON_GIE = ON
>   changeLum = FALSE
> end loop
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "jallib" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/jallib/cdf66d12-1e34-4563-9d26-345617726af0o%40googlegroups.com
> <https://groups.google.com/d/msgid/jallib/cdf66d12-1e34-4563-9d26-345617726af0o%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
> --
> You received this message because you are subscribed to the Google Groups
> "jallib" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/jallib/AM0PR07MB6241E981A94CAD71E293ABCFE6720%40AM0PR07MB6241.eurprd07.prod.outlook.com
> <https://groups.google.com/d/msgid/jallib/AM0PR07MB6241E981A94CAD71E293ABCFE6720%40AM0PR07MB6241.eurprd07.prod.outlook.com?utm_medium=email&utm_source=footer>
> .
>

<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
Garanti
sans virus. www.avast.com
<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>

-- 
You received this message because you are subscribed to the Google Groups 
"jallib" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jallib/CAD9DK3KRQ%3DwE4NuYqB_h4qWFUCbDjGOej9s3qGHd3EJ7my_-sQ%40mail.gmail.com.

Reply via email to