Author Topic: [PIC18F2523] ADC ISR being called when ADIE is not set?  (Read 862 times)

0 Members and 1 Guest are viewing this topic.

Offline Sudo_apt-get_install_yumTopic starter

  • Regular Contributor
  • *
  • Posts: 165
  • Country: se
[PIC18F2523] ADC ISR being called when ADIE is not set?
« on: September 25, 2024, 08:23:15 am »
Hi!

Im reworking some code for a PCI18. For whatever reason the ADC "conversion complete" ISR is being executed even though the ADC Interrupt Enable (ADIE) bit is not set in the PIE1 register.
ADIF is set in PIR1 when the ISR is called but why is it called?

Im using MPLAB X version 6.2.

Appreciate any input, i'm not to familiar with with PICs  :-[ ;D

Interrupt registers when ISR is called


ISR


ADC config

 

Offline Sudo_apt-get_install_yumTopic starter

  • Regular Contributor
  • *
  • Posts: 165
  • Country: se
Re: [PIC18F2523] ADC ISR being called when ADIE is not set?
« Reply #1 on: September 25, 2024, 08:31:12 am »
I think i just realized my mistake  |O

The ADC conversion time is the same as one of my timers who uses interrupts.
Timer overflows -> ISR gets called  (ADIF is set)

ADIF macro/ if statement is run...

In my defence I'm used to separate ISR functions for each peripheral.  ;D

Sometimes...  :-DD
« Last Edit: September 25, 2024, 08:34:33 am by Sudo_apt-get_install_yum »
 

Offline JPortici

  • Super Contributor
  • ***
  • Posts: 3523
  • Country: it
Re: [PIC18F2523] ADC ISR being called when ADIE is not set?
« Reply #2 on: September 25, 2024, 01:10:25 pm »
I think i just realized my mistake  |O

The ADC conversion time is the same as one of my timers who uses interrupts.
Timer overflows -> ISR gets called  (ADIF is set)

ADIF macro/ if statement is run...

In my defence I'm used to separate ISR functions for each peripheral.  ;D

Sometimes...  :-DD

which is why you are advised to use
if (ADIF && ADIE)
in the compiler manual
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf