0% found this document useful (0 votes)
25 views3 pages

Exp 9

This document describes an experiment to generate PWM signals using a timer on the MSP430 microcontroller. It outlines the objective, apparatus, software, and algorithm required which involves configuring a timer and ports to output PWM signals with varying duty cycles controlled by timer interrupts. The program code, procedure, and results are also presented along with precautions for implementing the experiment.

Uploaded by

Abhay Tomar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views3 pages

Exp 9

This document describes an experiment to generate PWM signals using a timer on the MSP430 microcontroller. It outlines the objective, apparatus, software, and algorithm required which involves configuring a timer and ports to output PWM signals with varying duty cycles controlled by timer interrupts. The program code, procedure, and results are also presented along with precautions for implementing the experiment.

Uploaded by

Abhay Tomar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 3

EXPERIMENT-9

OBJECTIVE: Write a program of PWM generation using Timer on MSP430 GPIO

APPARATUS REQUIRED: MSP430F5529 Launch pad, wires, desktop etc.

SOFTWARE REQUIRED: Code composer studio

ALGORITHM:
1. Stop watch dog timer.
2. The port pin P1.6 connected to the green LED is configured as PWM output of Timer A
Configure port 1.0 as output.
3. The Timer A is configured with the required period (TA0CCR0) and the PWM duty cycle
(TA0CCR1) is set to first value in the predefined array.
4. The Timer is configured in Set/Reset output mode 7.
5. The Timer A control register is set to use SMCLK as clock source for up counting.
6. The global interrupt is enabled, and the processor is switched to low power mode 0
(LPM0)..
7. On interrupt by the Timer, the PWM duty cycle (TA0CCR1) is set to the next value from
the predefined array..

FLOWCHART
PROGRAM REQUIRED

#include <msp430.h>

int main(void)

WDTCTL = WDTPW + WDTHOLD; // Stop WDT

P2DIR |= BIT0+BIT4; // P2.0 and P2.1 output

P2SEL |= BIT0+BIT4; // P2.0 and P2.1 options select

TA1CCR0 = 128; // PWM Period/2

TA1CCTL1 = OUTMOD_6; // CCR1 toggle/set

TA1CCR1 = 32; // CCR1 PWM duty cycle

TA1CCTL2 = OUTMOD_6; // CCR2 toggle/set

TA1CCR2 = 96; // CCR2 PWM duty cycle

TA1CTL = TASSEL_2 + MC_3 + TACLR; // SMCLK, up-down mode, clear TAR

__bis_SR_register(LPM0_bits); // Enter LPM0

__no_operation(); // For debugger

PROCEDURE

1. Check the program and debug it.


2. Connect the kit.
3. Load the program (hexfile) into the controller.
4. Check the results of the program.

RESULT

The program is executed on the msp430 and verified.


Fig 8.1:PWM waveforms

PRECAUTIONS

1. Verify the program before loading it on msp430.


2. Connect the modules to msp430 right and tight.
3. Make sure the msp430 kit is connected properly to the computer.

You might also like