PWM on MCF51JM128

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

PWM on MCF51JM128

913 次查看
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?

标签 (1)
0 项奖励
回复
2 回复数

623 次查看
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 项奖励
回复

623 次查看
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 项奖励
回复