Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

interrupts

Status
Not open for further replies.

butters

Member
Code:
void rx_handler (void);//declare the ISR function.HIGH
void pull_chord (void);//declare the ISR function.LOW


//location of the ISR.(HIGH)
#pragma code rx_interrupt = 0x8
void rx_int (void)
{
  _asm goto rx_handler _endasm
}
#pragma code  //return to default code section


//location of the ISR.(LOW)
#pragma code low_pull = 0x18
void low_pull (void)
{
  _asm goto pull_chord _endasm
}
#pragma code  //return to default code section


is it something like this?
 

Pommie

Well-Known Member
Most Helpful Member
Yes, but as well you have to enable interrupt priorities (IPEN=1) and set the individual priority bits in IPR1 and IPR2 and the enable bits GIEL and GIEH.

Edit, there's an example(#7) in the C18 getting started pdf.

Mike.
 
Last edited:

Pommie

Well-Known Member
Most Helpful Member
Be careful. Interrupt preemption is not a good practice especially in C. It eats memory and usually does not provide any performance benefits.

This is not a multitasking environment. It is a simple interrupt on a microcontroller. You have no need to worry.

BTW, in what language is it a good practice?

Mike.
 
Status
Not open for further replies.

Latest threads

EE World Online Articles

Loading
Top