Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

ARM7 LPC2378 PWM Generation

Status
Not open for further replies.

BISH

Junior Member level 2
Joined
Nov 3, 2012
Messages
23
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,418
hello all,

i have some trouble in generating pwm in arm7 lpc2378. can anyone please provide me with a code?
thanks in advance...
 

Code:
A sample example code...
#include <LPC23xx.H> /* include for LPC23xx */

static void PWMInit(){
    /* considering LPC2387 */
    /* Select PWM1.2 output on P1.20 */
    PINSEL3 |= (0x2 << 8);

    /* reset PWM counter */
    PWM1TCR = 0x02;

    /* setup match control to reset on MR0 */
    PWM1MCR = 0x02;

    /* select single edge for PWM1.2 and enable PWM1.2 o/p */
    PWM1PCR = 1 << 10;

    /* setup PWM period */
    PWM1MR0 = 100;

    /* setup PWM duty cycle (50%) */
    PWM1MR2 = 50;

    /* start counter and enable PWM */
    PWM1TCR = 0x81;

    /* enable LER */
    PWM1LER = 0x04;
}

int main(){
    PWMInit();
    while(1);
}



just intialise the VIC and do your required function in ISR....
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top