OSDN Git Service

[Schematic][v2.0] Add common-mode transformer to input-line of SW/MW/LF AMP.
[openi2cradio/OpenI2CRadio.git] / adc_int.c
index 787bc19..df2c628 100644 (file)
--- a/adc_int.c
+++ b/adc_int.c
@@ -58,14 +58,12 @@ void intadc_init(void)
 unsigned int polladc(void)
 {
     unsigned int a;
+    PIE1bits.ADIE = 0;
+    PIR1bits.ADIF = 0;
     if(ADCON0bits.DONE){ // converting or not enable.
-        PIE1bits.ADIE = 1;
-        PIR1bits.ADIF = 0;
         return 0xffff;
     } else { // Done, Clear interrupt
         a = ((ADRESH << 8)  + ADRESL) & 0x03ff;
-     PIE1bits.ADIE = 0;
-     PIR1bits.ADIF = 0;
      ADCON0bits.GO_DONE = 0;
      return a;
     }