We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
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
That's what happens when you place a duplicate thread. I answered your other post at: http://www.keil.com/forum/docs/thread9317.asp
But this is the right place to post other answers anyway.
The Nordic chip is never mentioned in this thread. You should really open a new thread to discuss your problem Unfortunately I realized that just after I had pressed the Post button and so I did start the new thread. I apologize for this... I understand now the meaning of the using directive. So I removed the usage of this from the code, it still doesn't work. The code memory map looks like this...
0000H 0003H ABSOLUTE 0003H 0027H UNIT ?PR?PUTCHAR?PUTCHAR 002AH 0025H UNIT ?PR?MAIN?INTERRUPT 004FH 0010H UNIT ?PR?INIT?INTERRUPT 005FH 0004H UNIT ?CO?INTERRUPT 0063H 0003H ABSOLUTE 0066H 035CH UNIT ?PR?PRINTF?PRINTF 03C2H 008EH UNIT ?C?LIB_CODE 0450H 008CH UNIT ?C_C51STARTUP 04DCH 001DH UNIT ?PR?_DELAY100US?INTERRUPT 04F9H 0017H UNIT ?PR?_WRITERTC?INTERRUPT 0510H 0015H UNIT ?PR?RTCINT?INTERRUPT 0525H 0005H UNIT ?C_INITSEG
Note that the RTCINT function is showing up like any other function at address 0510H even after I have declared it as an Interrupt with the number 12 corresponding to 0063H !?! Any ideas?