Forums

PWM on Mat3_0 HELP

Started by Gigi August 14, 2007
Hello,

I would use a Pin P0_21 of a Lpc2103 as a PWM output

I have write any code but it not work! can anyone help me i do
not see the error...

this is my code

int main(void)
{

VPBDIV = 0x00000002;
PINSEL1 |= 0x00000800;
T3PR = 0x0000001E;
T3TCR = 0x00000002;
T3MCR = 0x00000600;
T3MR3 = 0x00000101;
T3MR0 = 0;
T3EMR = 0x00000408;
T3TCR = 0x01; // start timer

VICVectAddr4 = (unsigned)T0isr;
VICVectCntl4 = 0x00000024;
VICIntEnable |= 0x08000000;

while(1);
}

void T0isr (void) __irq
{
T3EMR |= 0x00000008;
T3MR0++;
T3MR0 = T3MR0 & 0x000000FF; //Limit duty cycle

T3IR |= 0x00000002;
VICVectAddr = 0x00000000;

}

An Engineer's Guide to the LPC2100 Series

On 'user.manual.lpc2101.lpc2102.lpc2103.pdf', Rev. 02 1 August 2007 there
a print error:

On page 204 of the PDF, where you can read:
5.3 Count Control Register (CTCR, TIMER2: T2CTCR - 0xE007 0070 and TIMER3:
T3TCR - 0xE007 4070)

and

Table 178: Count Control Register (CTCR, TIMER2: T2CTCR - address 0xE007
0070 and TIMER3: T3TCR - address 0xE007 4070) bit description

The right sentences are:

5.3 Count Control Register (CTCR, TIMER2: T2CTCR - 0xE007 0070 and TIMER3:
T3CTCR - 0xE007 4070)

and

Table 178: Count Control Register (CTCR, TIMER2: T2CTCR - address 0xE007
0070 and TIMER3: T3CTCR - address 0xE007 4070) bit description
Gigi, try to use T3CTCR, instead of T3TCR, check the values and try again.
:-D

--
Thiago Lima
Electrical Engineer

As you can see on page 203 of the PDF
On 14/08/07, Gigi wrote:
>
> Hello,
>
> I would use a Pin P0_21 of a Lpc2103 as a PWM output
>
> I have write any code but it not work! can anyone help me i do
> not see the error...
>
> this is my code
>
> int main(void)
> {
>
> VPBDIV = 0x00000002;
> PINSEL1 |= 0x00000800;
> T3PR = 0x0000001E;
> T3TCR = 0x00000002;
> T3MCR = 0x00000600;
> T3MR3 = 0x00000101;
> T3MR0 = 0;
> T3EMR = 0x00000408;
> T3TCR = 0x01; // start timer
>
> VICVectAddr4 = (unsigned)T0isr;
> VICVectCntl4 = 0x00000024;
> VICIntEnable |= 0x08000000;
>
> while(1);
> }
>
> void T0isr (void) __irq
> {
> T3EMR |= 0x00000008;
> T3MR0++;
> T3MR0 = T3MR0 & 0x000000FF; //Limit duty cycle
>
> T3IR |= 0x00000002;
> VICVectAddr = 0x00000000;
>
> }
>
>
>