cancel
Showing results for 
Search instead for 
Did you mean: 

External Interrupt

art
Associate II
Posted on April 22, 2004 at 06:40

External Interrupt

5 REPLIES 5
art
Associate II
Posted on April 19, 2004 at 12:29

Hey all,

Controller: ST7FLITE09

can someone tell me how I can disable my external interrupt??

I have a timer interrupt, so it's not possible to disable all Interrupts.

I looked in the manual and I understood it like I have to set the Input

for disable and enable

So I set the Input, (PAOR7;PAOR1) for enable and if I want to disable I set it back to zero. So that they are still Inputs, but in floating mode!

But it doesn't work! I tested some stuff and I think it is a problem of the interrupts!

My external interrupts are one rising and one falling edge, which are connected with the transformed Line Sense Voltage.

Ok, hope to hear something interesting from you!

Bagus_lah
jatin
Associate II
Posted on April 20, 2004 at 10:23

What are the instructions you use to switch from interrupt enable to disable mode? If you are using bset and bres instructions then use it with care or simply use OR, AND instructions to modify the I/O registers.

Othercase may be you are getting the pending interrupt.

[ This message was edited by: Jatin on 20-04-2004 13:55 ]
art
Associate II
Posted on April 20, 2004 at 13:00

Hey Jatin,

What are the instructions you use to switch from interrupt enable to disable mode?

I use the instruction with modifieing the I/O Register.

With SetBit(PAOR,0) I enable the External Interrupt 0 and disable with ClrBit(PAOR,0).

Hope this is OK, for what can I use the AND instruction???

The rising edge works so far, now I have the Problem with the falling edge only mode!!

If I activate the falling mode it happens the same as in the falling edge mode and in the Rising and falling mode!

The Interrupts are always on if the falling edge/ low level are on the pin! When it rise up, it they'll get stopped!

Hope you understand what I mean!

??? again and shorter:

I set falling edge and if I come to the low level, I get every 23 mikrosec an ext0 interrupt until the high level is reached!

I changed the controller with a new one and it also doesn't work!

Thanks for your help and hope to get a answer again,

Bagus_lah

[ Diese Nachricht wurde editiert von : Bagus_lah on 20-04-2004 16:44 ]

jatin
Associate II
Posted on April 21, 2004 at 12:55

Could you attach your code?

art
Associate II
Posted on April 22, 2004 at 06:40

Ok here is my main code:

//Portinit

PADDR = 0x7E; // PORTA: bits 1,2,3,4,5,6 (output=1)/

0,7 Input

PAOR = 0x7E; // PushPull

PADR = 0x81; // Outputs 0 setzen

PBDDR = 0x11; // Port B: bits 0&4 (output=1)/ 1..3 Input

PBOR = 0x11; // Pullup

ClrBit(PBDR,0); // PortB,1 Null setzen

ClrBit(PBDR,4); // PortB,2 Null setzen

// External Interruptinit

sim(); // setzen des IBIT/ IR inaktiv

EICR=0x09; // ei0-->pos edge / ei1-->neg edge

rim(); // ruecksetzen des IBITs/ IR aktiv

edge_select=0; // falling or rising edge turn

SetBit(PAOR,0); // Enable pos edge / ext interrupt 0

SetBit(PAOR,7); // Enable neg edge/ ext interrupt 1

for(;

{

SetBit(LTCSR,0);// Watchdog reset delay

SetBit(PADR,2);

for(j=0;j

{

for(i=0;i

{

}

}

ClrBit(PADR,2);

if(edge_select==0x00) // for edge_select 2-->neg.edge; 0-->

pos edge

{

SetBit(PAOR,0); // Enable pos edge

edge_select=0x01;

}// if edge_select=0

if(edge_select==0x02) // neg. edge

{

SetBit(PAOR,7); // Enable neg edge

edge_select=0x03;

}// else

_asm(''nop'');

_asm(''nop'');

_asm(''nop'');

}//for Neverendingloop

}//main

and the interrupt code for the ext int:

@interrupt void ext_1(void)

{

/********* external Interrupt 1 Negative Edge ************************/

SetBit(PADR,6);

edge_select=0x00; // Enable for pos edge

ClrBit(PAOR,7); // external Interrupt 1 disable

ClrBit(EICR,1); // Set pos edge

SetBit(EICR,0); // Set pos edge

_asm(''nop'');

// some mor nops to see it in the Oscilloscop

_asm(''nop'');

ClrBit(PADR,6);

}// ir ext_1

@interrupt void ext_0(void)

{

/********* externer Interrupt 0 Positive edge ************************/

SetBit(PADR,5);

edge_select=0x02;

ClrBit(PAOR,0); // external Interrupt 0 disable

SetBit(EICR,3); // Set neg edge

ClrBit(EICR,2); // Set neg edge

_asm(''nop'');

// some mor nops to see it in the Oscilloscop

_asm(''nop'');

ClrBit(PADR,5); //Controllbit for extint0

}// ir ext_0

this is my code, I just want that the pos and the neg edge are switching of each other, so that they coming in turn.

I'm really interested for the answer,

thanks

Bagus_lah