Sir,I have written a this code below to run a VGA from LPC2148 but interupt service routine is not called can u suggest a solution I have also edited startup file but it wont work
#include <lpc214x.h> #include "clk.h" int vcount=0,video=0; void initPWM(void); __irq void IRQ_Handler(void); int main(void) { PINSEL2=0x0; FIO0DIR=(1<<22); FIO1DIR=(1<<17)|(1<<18)|(1<<19); initclk(); initPWM(); } __irq void IRQ_Handler(void) { unsigned long int reg; reg=PWMIR; if((1<<0) & PWMIR) { video=1; vcount++; if(vcount<480 && video==1) { FIO0SET=(1<<22); FIO1SET=(1<<17); FIO1CLR=(1<<17); } else if(vcount>=480 && vcount<494) { FIO0SET=(1<<22); video=0; } else if(vcount>=494 && vcount<496) { FIO0CLR=(1<<22); } else if(vcount>=496 && vcount<528) { FIO0SET=(1<<22); } else if(vcount>=528) { FIO0SET=(1<<22); video=1; vcount=0; } } else if((1<<3) & PWMIR) { video=0; } PWMIR=reg; VICVectAddr = 0x0; } void initPWM(void) { /*Assuming that PLL0 has been setup with CCLK = 60Mhz and PCLK also = 60Mhz.*/ /*This is a per the Setup & Init Sequence given in the tutorial*/ PINSEL1 |=(1<<12); PWMPCR = (1<<5); //Select Double Edge PWM PWMPR = 0; PWMMR0 = 1906;//a total pulse duration of nearly 31.77 us PWMMR3 = 1510;//MR3 register match on 25.17 us and with this interupt genration PWMMR4 = 1792;//MR4 register match on 29.88 us PWMMR5 = 1566;//MR5 register match on 26.11 us PWMMCR = (1<<9)|(1<<1)|(1<<0); // Reset PWMTC on PWMMR0 match PWMLER = (1<<5)|(1<<4)|(1<<3) | (1<<0); // update MR0 and MR1 PWMPCR |= (1<<13); // enable PWM output PWMTCR = (1<<1) ; //Reset PWM TC & PR //Now , the final moment - enable everything PWMTCR = (1<<0) | (1<<3); // enable counters and PWM Mode //PWM Generation goes active now - LED must be 25% Bright after Reset!! //Now you can get the PWM output at Pin P0.21! VICDefVectAddr = (unsigned)IRQ_Handler;//address of irq VICIntEnable=(1<<8); }
clk header file just feeds the pll seqence and genrates 60Mhz clk and pclk
changes in startup.s:
; Exception Vectors ; Mapped to Address 0. ; Absolute addressing mode must be used. ; Dummy Handlers are implemented as infinite loops which can be modified. Vectors LDR PC, Reset_Addr LDR PC, Undef_Addr LDR PC, SWI_Addr LDR PC, PAbt_Addr LDR PC, DAbt_Addr NOP ; Reserved Vector LDR PC, IRQ_Addr LDR PC, [PC, #-0x0FF0] ; Vector from VicVectAddr LDR PC, FIQ_Addr IMPORT IRQ_Handler Reset_Addr DCD Reset_Handler Undef_Addr DCD Undef_Handler SWI_Addr DCD SWI_Handler PAbt_Addr DCD PAbt_Handler DAbt_Addr DCD DAbt_Handler DCD 0 ; Reserved Address IRQ_Addr DCD IRQ_Handler FIQ_Addr DCD FIQ_Handler Undef_Handler B Undef_Handler SWI_Handler B SWI_Handler PAbt_Handler B PAbt_Handler DAbt_Handler B DAbt_Handler ;IRQ_Handler B IRQ_Handler FIQ_Handler B FIQ_Handler ; Reset Handler EXPORT Reset_Handler Reset_Handler
You probably shouldn't exit main(), and you should comment out the code you replaced in the start up file.
Can you getting any of the timing signals to pins and verify them?
How are you determining there are no interrupts?
Sir i did that before applied a while(1) loop inside the main but still the interrupt service routine wasn't called ,Actually what i found out in the simulation was that whenever interrupt is generated the code gets stuck in a infinite loop inside the startup.s file