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