B butters Member Jul 27, 2009 #1 is it possible to put both high and low priority interrupts in a program? c18...
B butters Member Jul 27, 2009 #3 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?
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?
P Pommie Well-Known Member Most Helpful Member Jul 27, 2009 #4 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: Jul 27, 2009
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.
E ella New Member Jul 28, 2009 #6 Be careful. Interrupt preemption is not a good practice especially in C. It eats memory and usually does not provide any performance benefits.
Be careful. Interrupt preemption is not a good practice especially in C. It eats memory and usually does not provide any performance benefits.
P Pommie Well-Known Member Most Helpful Member Jul 28, 2009 #7 ella said: Be careful. Interrupt preemption is not a good practice especially in C. It eats memory and usually does not provide any performance benefits. Click to expand... 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.
ella said: Be careful. Interrupt preemption is not a good practice especially in C. It eats memory and usually does not provide any performance benefits. Click to expand... 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.