Ok somebody from lpc2000 group helped me good and my problem (at least teh IRQ thing) is solved now.
#include "LPC214x.h"
#include <ctl_api.h>
#define PLOCK 0x400
void init(void);
void delay_ms(int);
void isr_servo_out(void);
volatile int servo;
void init_isr(void)
{
ctl_global_interrupts_enable(); // interrupts enabled
ctl_set_isr(4, 0, CTL_ISR_TRIGGER_FIXED, isr_servo_out, 0); //interrupt set
ctl_unmask_isr( 4); //interrupt unmasked
}
void isr_servo_out(void)
{
IOSET0 = 0x00200000; // and there was light
T0IR = 0x01; //clear interrupt
}
int main(void)
{
init();
init_isr();
PINSEL1 = 0x00002000; //p0.22 = capture 0.1 (timer0)
IODIR0 = 0x00200C00; //p0.10, p0.11, p0.21 = GPIO output
IOSET0 = 0x00000C00; // LED1+2 off
T0TCR = 0x02; //reset counter
T0IR = 0xff;
T0CCR = 0x00000005; //capture on rising edge
T0TCR = 0x00000001; //enable timer
while(1){
}
}
void init(void)
{
PLLCFG=0x24; //set multiplier/divider values
PLLFEED=0xaa;
PLLFEED=0x55;
PLLCON=0x01; //enable PLL
PLLFEED=0xaa;
PLLFEED=0x55;
while(!(PLLSTAT & PLOCK)); //wait for the PLL to lock to set frequency
PLLCON=0x3; //connect the PLL as the clock source
PLLFEED=0xaa;
PLLFEED=0x55;
MAMCR=0x02; //enable MAM
MAMTIM=0x04; //set number of clocks for flash memory fetch
VPBDIV=0x01; //set peripheral clock(pclk) to system clock(cclk)
}