Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   Interrupts in the C18 3.0 software (http://www.chiefdelphi.com/forums/showthread.php?t=61095)

JohnC 08-01-2008 19:01

Interrupts in the C18 3.0 software
 
I'm reading interrupts.c and I notice that Initialize_Int_N() sets a register (I think it's a register) to 0, which the comment says disables the interrupt.

Why is this done? Should I change that to a 1? If so, it seems like it would make more sense to have a Set_Interrupt_N(int) function so that the interrupts can be turned on and off.

Anyway, why isn't this defaulted to 1 since users have to uncomment the ENABLE_INT_N macros for the function to "exist" in the first place? Maybe I'm just confused?

interfect 09-01-2008 22:27

Re: Interrupts in the C18 3.0 software
 
Could it be that the register being 1 disables the interrupt, and the register being 0 would thus enable it? I haven't seen the code, so I don't really know what I'm talking about, but that would make sense.

Or maybe you're supposed to enable it later.

Kevin Watson 10-01-2008 02:58

Re: Interrupts in the C18 3.0 software
 
Quote:

Originally Posted by JohnC (Post 672670)
Why is this done?

Leaving it at zero allows you to use the interrupt hardware in polled mode, which is nice because you don't need to write an interrupt service routine.

-Kevin

JohnC 10-01-2008 03:18

Re: Interrupts in the C18 3.0 software
 
Quote:

Originally Posted by Kevin Watson (Post 674158)
Leaving it at zero allows you to use the interrupt hardware in polled mode, which is nice because you don't need to write an interrupt service routine.

-Kevin

I'm confused. How does that accomplish anything? How do you do something with the interrupt without an ISR?

Kevin Watson 10-01-2008 13:02

Re: Interrupts in the C18 3.0 software
 
Quote:

Originally Posted by JohnC (Post 674160)
I'm confused. How does that accomplish anything? How do you do something with the interrupt without an ISR?

You poll the interrupt flag bit and wait for it to change.

-Kevin


All times are GMT -5. The time now is 23:19.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi