How Can I Offset a PWM Channel on My ARM Microcontroller?
Primary Software: LabVIEW Modules>>Embedded Module for ARM Microcontrollers
Primary Software Version: 1.0
Primary Software Fixed Version: N/A
Secondary Software: N/A
Problem: I can use a single PWM channel, but I now want to offset my single PWM channel. How do I do this, and what resources are needed?
Solution: Yes, you can offset a PWM ouput signal on an ARM Microcontroller. Depending on which microcontroller you're using, there are different procedures. Two procedures are outlined below:
Keil MCB2300 (ARM microcontroller):
- Create an ARM project for your MCB2300 target.
- Right-click on the embedded target and select New » Elemental I/O.
- Expand PWM Output, select a PWM channel (1-6), Add the channel, and press OK.

- Right-click on the PWM channel in the Project Explorer window, and select Properties.
- Select Double edge?
Note: Using the double edge feature on a PWM channel uses the PWM resource you selected as well as the PWM channel below the one you chose. (For example, if you chose to use double edge on PWM2, PWM1 would also be unavailable.) When a PWM channel is selected for use, other features also become unavailable. These features are listed in the Elemental I/O Properties window though.
- Specify a value for the Offset%. This value is the amount of time (in a percentage) before the first transition of the PWM pulse.
Note: The offset% value is ignored for the single edge (default) case.
- Specify the frequency of the PWM channel, and select OK.

- Input the PWM duty cycle into the PWM Elemental I/O block on the Block Diagram during run-time.
See the Double Edge PWM below.
Luminary Micro LM3S8962 (Cortex-M3 microcontroller):
- Create an ARM project for your LM3S8962 target.
- Right-click on the embedded target and select New » Elemental I/O.
- Expand PWM Output, select a PWM channel (0-5), Add the channel, and press OK.

- Drag the PWM channel listed in your Project Explorer Window onto your Block Diagram.
- Right-click on the PWM channel in the Block Diagram, and select Properties.
Note: You need to right-click in the white area in order to see the Properties menu.
- Specify the frequency of the PWM channel.
- Check the Alignment Center checkbox, and select OK.
Note: Using the Center Alignment feature on a PWM channel uses the PWM resource you selected as well as the PWM channel below the one you chose. (For example, if you chose to use Center Alignment on PWM1, PWM0 would also be unavailable.)

- Input the PWM duty cycle into the PWM Elemental I/O block on the Block Diagram during run-time.
See the Center Alignment PWM below.

Related Links: NI LabVIEW Embedded Module for ARM MicrocontrollersLabVIEW Embedded Module for ARM Microcontrollers 1.0 HelpGetting Started with the LabVIEW Embedded Module for ARM Microcontrollers 1.0 for the Luminary Micro LM3S8962Getting Started with the LabVIEW Embedded Module for ARM Microcontrollers 1.0 for the Keil MCB2300
Attachments:
Report Date: 10/03/2008
Last Updated: 10/06/2008
Document ID: 4Q2C8TXY