Yahoo Groups archive

Lpc2000

Index last updated: 2026-04-28 23:31 UTC

Thread

PWM isr

PWM isr

2006-04-25 by icapapindi

Hi !!

I'm trying to generate a PWM interrupt on match MR0 with this code:

PCB_PINSEL0 |= 0x00028000;      
GPIO0_IODIR = 0x00008000;               
GPIO0_IOSET = 0x00008000;           

VICVectAddr8 = (unsigned)IRQ_Routine;   
VICVectCntl8 = 0x00000028;                
VICIntEnable = 0x00000100;                

PCB_PINSEL0 |= 0x00028008;       
PWM_PR    = 0x00000000;                

PWM_PCR = 0x00000C0C;        
PWM_MCR = 0x00000003;                 
PWM_MR0 = 0x400;                         
PWM_MR1 = 0;                            
PWM_MR2 = 0x200;                       
PWM_MR3 = 0x400;                           
PWM_LER = 0xF;                           
PWM_TCR = 0x00000002;                    
PWM_TCR = 0x00000009;              

void  __attribute__ ((interrupt("IRQ"))) IRQ_Routine()
{
    static BOOLEAN bFlag=FALSE;
    if (!bFlag)
    {
        bFlag=FALSE;
        GPIO0_IOCLR=0x00008000;
    }
    else
    {
         bFlag=TRUE;
         GPIO0_IOSET=0x00008000;
    }

    PWM_IR       |= 0x00000001;               
    VICVectAddr  = 0x00000000;
}


The PWM is generate correctly but the interrupt not,have you got any
idea, the code is from Keil I think. Have you got any idea?

Thanks

Re: PWM isr

2006-04-25 by icapapindi

--- In lpc2000@yahoogroups.com, "icapapindi" <icayon@...> wrote:
>
> Hi !!
> 
> I'm trying to generate a PWM interrupt on match MR0 with this code:
> 
> PCB_PINSEL0 |= 0x00028000;      
> GPIO0_IODIR = 0x00008000;               
> GPIO0_IOSET = 0x00008000;           
> 
> VICVectAddr8 = (unsigned)IRQ_Routine;   
> VICVectCntl8 = 0x00000028;                
> VICIntEnable = 0x00000100;                
> 
> PCB_PINSEL0 |= 0x00028008;       
> PWM_PR    = 0x00000000;                
> 
> PWM_PCR = 0x00000C0C;        
> PWM_MCR = 0x00000003;                 
> PWM_MR0 = 0x400;                         
> PWM_MR1 = 0;                            
> PWM_MR2 = 0x200;                       
> PWM_MR3 = 0x400;                           
> PWM_LER = 0xF;                           
> PWM_TCR = 0x00000002;                    
> PWM_TCR = 0x00000009;              
> 
> void  __attribute__ ((interrupt("IRQ"))) IRQ_Routine()
> {
>     static BOOLEAN bFlag=FALSE;
>     if (!bFlag)
>     {
>         bFlag=FALSE;
>         GPIO0_IOCLR=0x00008000;
>     }
>     else
>     {
>          bFlag=TRUE;
>          GPIO0_IOSET=0x00008000;
>     }
> 
>     PWM_IR       |= 0x00000001;               
>     VICVectAddr  = 0x00000000;
> }
> 
> 
> The PWM is generate correctly but the interrupt not,have you got any
> idea, the code is from Keil I think. Have you got any idea?
> 
> Thanks
>

Hi !! I have solved it, I forgot to activate isr

Now I'm trying to generate single PWM but it doesn't work, has anybody
done it?

Thanks

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.