MPLAB Interrupt mit C18 Compiler

Gast #860779
Lesenswert?

Hallo zusammen,
ich habe probleme mit Interrupt. ich hatte schon low interrupt probiert 
und geschafft  aber mit high interrupt gibt immer Probleme. das sind 
meine Code
#include <p18F4550.h>
 #include "zip.h"
 #include <delays.h>

  #pragma code low_vector=0x18

 void  interrupt_at_low_vector(void)
 {
  _asm goto low_isr  _endasm
 }
 #pragma code /* return to default code section */
 #pragma interruptlow low_isr

 void low_isr(void)
      {
     if(INTCONbits.TMR0IF)
       {
    Interrupt_Timer_isr();
           INTCONbits.TMR0IF=0;
       }
      }
 #pragma code high_vector =0x08
 void interrupt_at_high_vector(void)
 {
   _asm goto high_isr _endasm
 }

 #pragma code /*return to default code section*/
 #pragma interruptlow high_isr
 void high_isr(void)
 {
  if(PIR1bits.TMR1IF)
        {
     Interrupt_Timer1();
            PIR1bits.TMR1IF=0;
         }
 }

 C:\Users\admin\Desktop\user\HL_interrupt.c:38:Error [1111] undefined 
label 'high_isr' in 'interrupt_at_high_vector'

 C:\Users\admin\Desktop\user\HL_interrupt.c:47:Warning [2058] call of 
function without prototype
#860952
Lesenswert?

HAllo,

hier mal mein Code, welcher bei mit funktioniert!

folgende Zeilen konfigurieren die Interrupt Prio:
1
  INTCONbits.GIEH = 1;    // Enable all HighPrio Interrupt
2
  INTCONbits.GIEL = 1;    // Enable all LowPrio Interrupt

Gruß
MAtthias

nachfolgend ein Auszug aus meinem Programm:

1
#pragma code low_vector=0x18
2
#pragma interruptlow low_isr 
3
void low_interrupt (void)
4
{
5
  _asm GOTO low_isr _endasm
6
}
7
#pragma code
8
// Low Interupt Routine
9
void low_isr (void){
10
  
11
  INTCONbits.GIEH = 0;    // Disable all HighPrio Interrupt
12
  INTCONbits.GIEL = 0;    // Disable all LowPrio Interrupt 
13
  
14
  // Auswertung des Timer - Interrupt
15
  if (INTCONbits.TMR0IF == 1){
16

17

18
    WriteTimer0(0xFFFF - 3125);
19
    INTCONbits.TMR0IF = 0;
20
    }
21

22
  INTCONbits.GIEH = 1;    // Enable all HighPrio Interrupt
23
  INTCONbits.GIEL = 1;    // Enable all LowPrio Interrupt
24
}

Antwort schreiben

Bitte melde dich an, um einen Beitrag zu schreiben.

oder

Mit Google-Account einloggen

Die Registrierung ist kostenlos und dauert nur eine Minute.

Jetzt registrieren