Forum: Mikrocontroller und Digitale Elektronik Low Voltage Detect Interrupt pic18f2585 C18 - Compiler


von Daniel H. (pic-mann)


Lesenswert?

Hallo!
Ich möchte, das beim unterschreiten einer gewissen Versorgungsspannung 
ein Interrupt ausgelöst wird, daher wäre LOW Voltage Detection optimal.
Dummerweise wird aber kein Interrupt ausgelöst.
(Benutze PIC18f2585, C18 Compiler mit MPLAB)
Hier ist der Quellcode:

#include <p18f2585.h>

void untersp (void);
#pragma config WDT = OFF
#pragma code low_vector=0x18
void low_interrupt (void)
{  _asm GOTO untersp _endasm
}
#pragma code

#pragma interruptlow untersp
void untersp (void)
{  //INTERRUPTCODE
}
void main (void)
{TRISB = 0;
  //PORTB = 0;
    HLVDCONbits.HLVDEN=0;
    HLVDCONbits.HLVDL3=1;
    HLVDCONbits.HLVDL2=1;
    HLVDCONbits.HLVDL1=1;
    HLVDCONbits.HLVDL0=0;
    HLVDCONbits.VDIRMAG=0;
    HLVDCONbits.HLVDEN=1;
    PIR2bits.HLVDIF=0;
    PIE2bits.HLVDIE=1;
    INTCONbits.GIE=1;


  while (1)
  {
  }
}



Danke schonmal!

Bitte melde dich an um einen Beitrag zu schreiben. Anmeldung ist kostenlos und dauert nur eine Minute.
Bestehender Account
Schon ein Account bei Google/GoogleMail? Keine Anmeldung erforderlich!
Mit Google-Account einloggen
Noch kein Account? Hier anmelden.