PWM Test Program for 5213 (per request from GreenE)

Post your example source code and application notes to share with others
Post Reply
joepasquariello
Posts: 85
Joined: Mon Apr 28, 2008 7:32 am

PWM Test Program for 5213 (per request from GreenE)

Post by joepasquariello »

GreenE,

Here is a PWM test program I wrote for the MOD5213 a couple of years ago. It configures PWM output on PWM0 and counts pulses on DTIN3. The function for setting up PWM0 is general enough to allow setting clock frequency, PWM periods, and duty cycles, but it's up to you to choose values that "make sense". The example shown should give you a good start.

When setting register bits, I use the macros in FreeScale's standard header files for the 5213. You can download them from FreeScale by searching for "MCF5213 header files". I just put all of headers into the MOD5213\Include folder, and since that's in the standard include search path, you don't have to change any settings in your NBE project.

Let us know how it goes.

Joe
Attachments
PWM5213main.cpp
PWM test program for 5213
(3.76 KiB) Downloaded 549 times
Ridgeglider
Posts: 513
Joined: Sat Apr 26, 2008 7:14 am

Re: PWM Test Program for 5213 (per request from GreenE)

Post by Ridgeglider »

GreenE and Joe:
Here are the zipped freescale headers for a variety of the NB platforms... Just add the 5213 folder's contents to the existing nburn/mod5213/include folder as shown in the picture below.
5213Includes.png
5213Includes.png (37.1 KiB) Viewed 6567 times
I like using them because the bit fields of most of the registers are named which makes the coding intent quite a bit clearer.

The headers came from: http://www.microapl.co.uk/CFInit/cfinit_download.html which installs a nice configuration tool for the coldfire processors. A great way to set up and familiarize yourself with some of the CF peripherals...

Once CFinit is installed, go to C:\Program Files\ColdFire Init\headers\Freescale to see all of the header files. Here's adescription: http://www.microapl.co.uk/CFInit/cfinit_main.html

Note that unfortunately CFInit is a little dated and only runs on a 32 bit windows platform.
Attachments
Freescale Headers.zip
(107.78 KiB) Downloaded 486 times
Post Reply