PWM on MCF51JM128

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

PWM on MCF51JM128

703 Views
b_rad
Contributor I

Hi There

 

I am trying to create a simple PWM signal on my MCF51JM128. Ive already tested the device with timer overflows and output compare mode which work perfectly. However, as soon as I set TPMxCnSC to operate in PWM mode I get nothing out. Its driving me mad.

 

My code is attached

 

Anyone got some advice?

Labels (1)
0 Kudos
2 Replies

413 Views
RichTestardi
Senior Contributor II

I didn't see any code in the attachment, just an mcp file?

 

I run PWM on the 51JM128 and you can see the code in the StickOS skeleton project at the bottom of this page: http://www.cpustick.com/downloads.htm

 

The file you want to look at is sources/pin.c, and follow the 51JM128 #if''s -- sorry there's lots of noise in the file for other MCUs.  The routine pin_declare_internal() sets up the pin for PWM mode (either servo or analog output) and pin_set() sets it to a specific value (in microseconds or millivolts) -- search for PIN_PTE3 for one of the pins with PWM capability.

 

-- Rich

0 Kudos

413 Views
b_rad
Contributor I

Thanks for the help Rich!

 

It turned out that I was setting up the registers in the incorrect order. I had followed the same procedure that I had been using in programming a GT16 chip which simply did not work on the JM128. All I had to do was re-order my code.

 

Brad

 

 

0 Kudos