Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronic 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.

Register Log in

ARM MICRO-CONTROLLER

ARM MICRO-CONTROLLER

Quick Overview

Category
Uncategorized
Language
Total members
291
Total events
0
Total discussions
20
Total views
2K
Total albums
0

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...
 

mathespbe

Full Member level 3
Joined
Jul 10, 2013
Messages
186
Helped
45
Reputation
90
Reaction score
44
Trophy points
28
Location
India, Tamilnadu, Coimbatore
Activity points
866
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.
Toggle Sidebar

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top