Interrupt Subrountine with mini2440

osama
Hi everyone!
I'm trying to write an example code about internal interrupt: timer delay (
use timer as an interrupt source) 
  But I dont know how to write interrupt subroutine. How the program know
the address to jump the subrountine when interrupt occurs?
   If anyone has any idea, please help me
   Thanks  alot
   nice day.:)

whitebank
i'm also in progress study this problem, but it seems harder than using
timer interrupt in Microcontroller.

Shahid Riaz
hi 
I am using timer4 as 1 mili sec timer for my applications. because I need
software timer and timer 4 dont have TOUT. So it run very perfectly. The
only problem with the timers are their initializing and timer value
setting, for what you have to understand the whole clock generation system
and PLL settings. 
This is very simple code. you can get delay upto 5.2 mili sec by dividing
the clock. This timer can be used as the integral part of any OS.

Keep enjoy.

Best regards.


#include "2440addr.h"
#include "Def.h"


int MiliSecCount


void Init_timer4(void);
void __irq Timer4_ISR(void);
void Led_Routine(void);


int main (void)
{

  Init_timer4;

  while(1);


}

void Init_timer4(void){

  rTCON &= 0xff8fffff;  //clear manual update bit, stop Timer1
  rTCFG0 &= 0xffff00ff;   //clear Timer 2,3 & 4 prescaler 1
  rTCFG0 |= 0xf00;        //set prescaler = 15+1 = 16  
  rTCFG1 &= 0xfff0ffff;   //set Timer4 1/2 Mux
  rTCFG1 |= 0x10000;      //set Timer4 MUX 1/4    
   rTCNTB4 = (PCLK / (4*15*1000)) - 1; // 1 mSec Time value    
  rTCON |= 0x200000;      //   manual updata 
  rTCON &= 0xff8fffff;    // down the manual update flag
  rTCON |= 0x500000;  // interval mode auto reload and start

  ClearPending(BIT_TIMER4);
  pISR_TIMER4= (U32) Timer4_ISR;  (This line load the ISR Routine address)
  EnableIrq(BIT_TIMER4);  
}


void __irq Timer4_ISR(void)
{

  if(++MiliSecCount==1000){
    MiliSec10Count = 0;
    
  }
}

void Led_Routine(void){


  //  what function do u want;



}

Anatoliy
Use instead PCLK simple number 20.

 rTCNTB4 = 20;  // it will give 1mS

And don't forget clear Interrupt

amir
Hi. 
this timer code is not working for me. did it work for anybody? whats
wrong? I'm trying to us a timer all week but nothing happening. I did read
user manual S3C2440.pdf and I did what it said but..... .
Is there anyone who can help me?