High interrupt Problem

Gast #912356
Lesenswert?
• ▲
▼
das ist Quellecode
void  Timer0(void)
{
 TMR0L = 0x00;
 TMR0H = 0x00;
 //Prescaler
 T0CONbits.T0PS0 = 0;
 T0CONbits.T0PS1 = 0;
 T0CONbits.T0PS2 = 1;

 T0CONbits.PSA = 0;
 T0CONbits.T0SE = 0;
 T0CONbits.T0CS = 0;
 T0CONbits.T08BIT = 0;//FFFF 0000
 RCONbits.IPEN = 1;
 INTCON2bits.TMR0IP =1;  // High Priority
 INTCONbits.TMR0IF =0;   // Flag
 INTCONbits.TMR0IE =1;

 T0CONbits.TMR0ON =1;
 INTCONbits.GIE=1;   // General  Interrupt

}
#pragma code low1_vector=0x18
 void  interrupt_at_low_vector(void)
 {
  _asm goto low1_isr  _endasm
 }
 #pragma code /* return to default code section */
 #pragma interruptlow low1_isr
 void low1_isr(void)
      {
     if(INTCONbits.TMR0IF)
       {
     //PS¬_Timer0();
           INTCONbits.TMR0IF=0;
       }
      }

#pragma interrupt MyHighISR
void MyHighISR(void)
{
  if(INTCONbits.TMR0IF)
       {
         PS_Timer0();
           INTCONbits.TMR0IF=0;
       }

}
#pragma code highVector=0x08
void HighVector (void)
{
   _asm goto MyHighISR _endasm
}

#pragma code /* return to default code section */

void  PS_Timer0(void)
     {
       Delay10ms();

     if(Array[1].Value10ms == 1)
               {
              LATDbits.LATD1=1;
             }
  if(Array[1].Value10ms == INPUT_LOW)
               {
              LATDbits.LATD1=0;
             }
     }
Gast #913225
Lesenswert?
• ▲
▼
Nimm das als Grundlage. Genau wie aus den Beispielen von Microchip.
1
void low_isr(void);
2
void high_isr(void);
3

4
#pragma code low_vector=0x18
5
void interrupt_at_low_vector(void)
6
{
7
_asm GOTO low_isr _endasm
8
}
9
#pragma code /* return to the default code section */
10

11
#pragma interruptlow low_isr
12
void low_isr (void)
13
{
14
}
15

16
#pragma code high_vector=0x08
17
void interrupt_at_high_vector(void)
18
{
19
_asm GOTO high_isr _endasm
20
}
21
#pragma code /* return to the default code section */
22

23
#pragma interrupt high_isr
24
void high_isr (void)
25
{
26
}

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