detect PWM on Port T and relay it to Port P

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

detect PWM on Port T and relay it to Port P

2,251件の閲覧回数
gokilz
Contributor I

Hello everyone,

 

i need to detect PWMs on port T (The PWMs are from other board) and need to relay the PWMs to port P.

I use MC9S12XDP512MAG on my board.

has anyone any idea?

My first idea would be with Enhanced Capture Timer.

 

Thanks before.

ラベル(1)
タグ(1)
0 件の賞賛
返信
5 返答(返信)

1,767件の閲覧回数
Fast
Contributor V

This is an ideal task for XGATE, read and write in endless loop, but why waste powerful ports like ECT and PWM.

Rich A

0 件の賞賛
返信

1,767件の閲覧回数
gokilz
Contributor I

Hi Rich,

sorry for my lately reply.

Can you give me some clue, how can i make it work?

Zef

0 件の賞賛
返信

1,767件の閲覧回数
kef2
Senior Contributor V

Zef,

CW project wizard generated XGATE enabled project enables XGATE and triggers XGATE software interrupt, which is triggered to run again and again. You need to modify SoftwareTrigger0_Handler in xgate.cxgate and place there code to read PTIT bit and copy it to PTP bit.

This should work for low freq. PWM's.

Please keep in mind however that you need to either have nothing else connected to port P pins (only copied PWM), or use XGSEM register from CPU12X code and csem() / ssem() calls from XGATE code to prevent simultaneous accesses to PTP register. Else weird things may happen.

0 件の賞賛
返信

1,767件の閲覧回数
gokilz
Contributor I

Hi Edward,

thanks for your clue. I can now relay the PWM. Now i want to know, how can i calculate the dutycycle of the PWM?

I've already made a counter for the Ton and Toff, then calculate it for the dutycycle. But somehow it doesn't work.

Has anyone idea?

Thanks

0 件の賞賛
返信

1,767件の閲覧回数
kef2
Senior Contributor V

Zef,

you may use ECT input capture to measure pulse width and period.

0 件の賞賛
返信