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.
This is an ideal task for XGATE, read and write in endless loop, but why waste powerful ports like ECT and PWM.
sorry for my lately reply.
Can you give me some clue, how can i make it work?
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.
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?
you may use ECT input capture to measure pulse width and period.
Retrieving data ...