EN0
Member
Hey Everyone,
I'm working on a project that requires my μC to wake up from sleep via an interrupt. I am using the PIC12F629 and HI-TECH compiler, but I'm don't quite understand how everything works.
The basic analogy of the program will run through some code if one of the IOC switches is activated. I'm told that I can't poll the GPIF bit while sleeping, so I assume I poll the GPIE bit?
Another notable factor that contravenes with my understanding is a peripheral interrupt. What are the differences and similarities that exist between a peripheral interrupt and a global interrupt? As shown in the datasheet (depicted in the attachement).
Really, the only misunderstanding I have is those two facets. In algorithm form, I believe I'll first determine the INTCON settings, then IOC settings, and figure out some way to 'know' when an interrupt occurred in the main function. For instance,
or
Which one can I use? In the former arrangement, would I have to press the switch once to enable the interrupt and wake from sleep, then again to actually make it activate code?
I would appreciate any help!
Thanks,
Austin
I'm working on a project that requires my μC to wake up from sleep via an interrupt. I am using the PIC12F629 and HI-TECH compiler, but I'm don't quite understand how everything works.
The basic analogy of the program will run through some code if one of the IOC switches is activated. I'm told that I can't poll the GPIF bit while sleeping, so I assume I poll the GPIE bit?
Another notable factor that contravenes with my understanding is a peripheral interrupt. What are the differences and similarities that exist between a peripheral interrupt and a global interrupt? As shown in the datasheet (depicted in the attachement).
Really, the only misunderstanding I have is those two facets. In algorithm form, I believe I'll first determine the INTCON settings, then IOC settings, and figure out some way to 'know' when an interrupt occurred in the main function. For instance,
Code:
if(!GPIOX) // Examine whatever pin you use?
{
Code;
}
or
Code:
if(GPIE) // Use GPIO enable bit to examine status?
{
Code;
}
Which one can I use? In the former arrangement, would I have to press the switch once to enable the interrupt and wake from sleep, then again to actually make it activate code?
I would appreciate any help!
Thanks,
Austin