Hello All,
A newbie to this forum, I was going through a lot of threads and found that this thread is already talking about the interrupt problem in Nordic nrf24e1. I am working with the same chip and having trouble programming the interrupt. Here is the brief. I am using the RTC to wake up from sleep. The program should vector to the programmed interrupt and after exiting the interrupt should go to the next instruction after the sleep (thats what it says in the manual...) and output the value that I am changing in the interrupt. It should keep doing this just to show that the interrupt works.
Here is the code: #pragma iv(0x0000) // Interrupt vector begins at 0 #pragma interval(8) // Interval for vector is 8
#include <Nordic\reg24e1.h> #include <stdio.h>
#define TICK 10e-3 // 10ms (100Hz) tick
unsigned char xdata a=0;
void WriteRTC(unsigned int w){
while(REGX_CTRL & 0x10) // Wait to be ready
;
REGX_MSB = w >> 8;
REGX_LSB = w & 0xff;
REGX_CTRL = 0x0a;
; }
void RTCINT (void) interrupt 12 using 0{
WDTI = 0; // reset RTC interrupt flag
a++;
}
void main(void){
EA = 1; // Enable Global Interrupt
EWDI = 1; // Enable RTC interrupt
PWDI = 1; // RTC Interrupt High priority
WriteRTC(1/TICK); // RTC Real time clock - 1 sec
while(1){
CK_CTRL = 0x01; // sleep
printf("%d\n",&a);
} I have enabled global interrupts and only one other interrupt, that is RTC. I am sure they are no other interrupt sources. I have put in the using operator as '0' since the default register bank is '0'. So my interrupt function will also be in bank '0'. The interrupt number is also correct according to the manuals. I tried with the breakpoints but the program just does not vector to the interrupt and increment 'a'! I don't know whether it is to do with the using or declaration or something else. Has anyone done it before and any differently than I have?
Thanks in advance,
- Nikhil