PWM on MCF51JM128

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

PWM on MCF51JM128

1,413件の閲覧回数
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 返答(返信)

1,123件の閲覧回数
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 件の賞賛
返信

1,123件の閲覧回数
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 件の賞賛
返信